[C++-sig] Some thoughts on py3k support

Hans Meine meine at informatik.uni-hamburg.de
Thu Mar 19 17:36:20 CET 2009


On Thursday 19 March 2009 09:02:35 Haoyu Bai wrote:
> By default we would use PyUnicode_AsUTF8String(), and encoding could
> be explicitly specified by a converter policy. That may keep most of
> your code compatible.

Please do *not* hard-code UTF-8.  At least, if you need to guess a default, 
use some system (locale) setting, similar to sys.stdout.encoding or 
sys.getfilesystemencoding().  Personally, I would prefer to have to specify 
the encoding somewhere in the BPL exporting code.

Thinking about it, it might even be necessary to determine the encoding at 
*runtime*, depending on the wrapped code/library. :-(

Have a nice day,
  Hans


More information about the Cplusplus-sig mailing list