En Sun, 09 Sep 2007 17:49:14 -0300, Fabio Zadrozny <[EMAIL PROTECTED]>
escribi?:

Does someone know if there's a way to explicitly set the stdout/stderr/
stdin
encoding that python should use?

The encoding can be set using the C API for file objects - from Python
code, use ctypes:

py> from ctypes import *
py> PyFile_SetEncoding = pythonapi.PyFile_SetEncoding
py> PyFile_SetEncoding.argtypes = (py_object, c_char_p)
py> if not PyFile_SetEncoding(sys.stdout, "hex"):
...     raise ValueError
...
py> print "Hello"
Hello
py> print u"Hello"
48656c6c6f

--
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to