This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Daniel.Goertzen, amaury.forgeotdarc, atuining, belopolsky, flox, grahamd, pitrou, vstinner
Date 2011-05-01.23:52:19
SpamBayes Score 9.536217e-09
Marked as misclassified No
Message-id <1304293940.46.0.961727107077.issue6501@psf.upfronthosting.co.za>
In-reply-to
Content
> On a Western Windows, I suggest
>    PYTHONIOENCODING=cp1252:backslashreplace

Why using this very small charset whereas a web server can use UTF-8?

I don't think that using backslashreplace on stdout is a good idea.

> But 
>    PYTHONIOENCODING=mbcs
> is also OK, except that characters outside the Windows code
> page will be replaced with '?'

Starting at Python 3.2, you should use mbcs:replace to replace unencodable characters by '?'. The strict error handler is now strict: it raises a UnicodeEncodeError if a character is not encodable to mbcs.

Note: mbcs is the ANSI code page.

--

Using device_encoding.patch, I suppose that sys.std* streams will use the ANSI code page (mbcs, which is the code page 1252 on a Western Windows setup) in grahamd's usecase (Python program running in Apache).
History
Date User Action Args
2011-05-01 23:52:20vstinnersetrecipients: + vstinner, amaury.forgeotdarc, atuining, belopolsky, pitrou, grahamd, flox, Daniel.Goertzen
2011-05-01 23:52:20vstinnersetmessageid: <1304293940.46.0.961727107077.issue6501@psf.upfronthosting.co.za>
2011-05-01 23:52:19vstinnerlinkissue6501 messages
2011-05-01 23:52:19vstinnercreate