Hi Lefteris, On 22 September 2014 19:37, Eleytherios Stamatogiannakis <est...@gmail.com> wrote: > b = unicode( ffi.buffer( clib.getString(...) ) ,'utf-8') > > because it'll only return the first character of getString, due to being > declared as a 'char*'.
The issue is only that ffi.buffer() tries to guess how long a buffer you're giving it, and with "char *" the guess is one (only ffi.string() has logic to look for the final null character in the array). You need to get its length explicitly, for example like this: p = clib.getString(...) # a "char *" length = clib.strlen(p) # the standard strlen() function from C b = unicode(ffi.buffer(p, length), 'utf-8') A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev