Q: The `print' statement over Unicode

François Pinard pinard at iro.umontreal.ca
Sat May 7 12:10:46 EDT 2005


[Martin von Löwis]

> 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.

My contributions are not that welcome.  If they were, the core team
would not try forcing me into using robots and bug trackers! :-)

> 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.

Thanks.  Your kind explanation, above, should make it, as is, somewhere
in the documentation -- until Xah decides to rewrite it, of course! :-).

-- 
François Pinard   http://pinard.progiciels-bpi.ca



More information about the Python-list mailing list