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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to