[Python-Dev] File encodings

Gustavo Niemeyer niemeyer at conectiva.com
Tue Nov 30 18:11:53 CET 2004


Hello Walter,

> >I don't see that as a good solution, since every Python software
> >that is internationalizaed will have do figure out this wrapping,
> >introducing extra overhead unnecessarily.
> 
> This wrapping is probably necessary for stateful encodings. If you
> had a sys.stdout.encoding=="utf-16", print would probably add the
> BOM every time a unicode object is printed. This doesn't happen if
> you wrap sys.stdout in a StreamWriter.

I'm not sure this is an issue for a terminal output stream, which
is the case I'm trying to find a solution for. Otherwise, Python
would already be in trouble for using this scheme in the print
statement. Can you show an example of the print statement not
working?

-- 
Gustavo Niemeyer
http://niemeyer.net


More information about the Python-Dev mailing list