> Am I using it in a wrong way or is it a bug? You are using it in a wrong way. The terminal window, on Windows, does not use the "mbcs" encoding. Microsoft has two system encodings: the "ANSI" code page (CP_ACP), called "mbcs" by Python, and the "OEM" code page (CP_OEMCP). The latter is what the terminal window uses. Python does not directly expose the Microsoft OEMCP codec; instead, it determines the terminal's code page, and then carries its own codec for that code page ("gbk" in your case).
To make your example work, replace "mbcs" with sys.stdout.encoding. HTH, Martin _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com