On Apr 19, 1:14 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > From what I've googled, I think I need to set my locale. > > Not on this operating system. On Windows, you need to change > your console. If it is a cmd.exe-style console, use chcp. > For IDLE, changing the output encoding is not supported. > > If you want to output into a file, use codecs.open. > > If you absolutely want to output UTF-8 to the terminal even > though the terminal will not be able to render it correctly, > use > > sys.stdout = codecs.getwriter("UTF-8")(sys.stdout)
Thank you for the suggestion. As I said, I am running Python through Emacs 22.2.1, so I doubt it is a cmd.exe-style console, and it most certainly is not IDLE. I want to output to the Emacs buffer, via the python-mode plugin for Emacs, not to a file. I tried your suggestion of setting sys.stdout, and it works perfectly. As I said, the output is going to Emacs, and Emacs _does_ know how to render UTF-8. How can I make this a global setting? Is it possible to change an environment variable, so that Python uses this coding automatically? Or pass a command-line argument when Emacs python-mode invokes the Python interpreter? Or execute this line of Python in a startup script which is invoked whenever a new Python session is started? Thank you again for your help, Damon. -- http://mail.python.org/mailman/listinfo/python-list