Hi list

we want to read from stdin and write to stdout using Unicode (utf-8 is the way 
to go) in Python on Win32.

This is what I normally do on Unix:

    >>> import locale
    >>> import sys
    >>> output_encoding = sys.stdout.encoding or locale.getpreferredencoding() 
or 'ascii'
    >>> print u"好".encode(output_encoding)

It seems this does not work straight away on Windows, question marks instead.

I can only test this in Wine emulation (so it's probably not much use), but 
there are at least two people on Windows with this issue. It seems to boil 
down to two things:
- tell Windows to use utf-8 in the console ('cmd /u' and setting some code-
page)
- get Python to read and write utf-8

I tried using the Win specific 'mbcs' encoding, but that didn't help. Btw, a 
bug with a bit more text is filed here: 
http://code.google.com/p/cjklib/issues/detail?id=11

I believe there is a solution to that and hope you people can help out.

-Christoph
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to