[Pyrex] Pyrex & Unicode

Stefan Behnel stefan_ml at behnel.de
Fri Nov 16 19:15:36 CET 2007


Greg Ewing wrote:
> Farzin Shakib wrote:
>> I am really struggling with with Pyrex and unicode.
> 
> Pyrex currently makes no attempt to handle unicode at all.
> You'll have to do it yourself using Python/C API calls,
> sorry.

Now that Greg mentions it, Cython supports at least unicode literals.

However, this doesn't solve the original problem as an automatic conversion
from a unicode object to a char* is impossible. It requires a target encoding
to convert from unicode characters to bytes.

Just as Python requires you to call "s.decode()" and "u.encode()", Pyrex will
require you to do some kind of explicit conversion.

Stefan



More information about the Pyrex mailing list