Q: The `print' statement over Unicode
"Martin v. Löwis"
martin at v.loewis.de
Sat May 7 09:54:57 EDT 2005
François Pinard wrote:
> Am I looking in the wrong places, or else, should not the standard
> documentation more handily explain such things?
It should, but, alas, it doesn't. Contributions are welcome.
The algorithm to set sys.std{in,out}.encoding is in
sysmodule.c:_PySys_Init and pythonrun.c:Py_InitializeEx
and goes roughly as follows:
- On Windows, if isatty returns true, use GetConsoleCP and
GetConsoleOutputCP.
- On Unix, if isatty returns true, langinfo.h is present,
CODESET is defined, and nl_langinfo(CODESET) returns a
non-empty string, use that.
- otherwise, .encoding will not be set.
Regards,
Martin
More information about the Python-list
mailing list