print() and unicode strings (python 3.1)
bbxx789_05ss at yahoo.com
Mon Aug 24 18:54:03 CEST 2009
On Aug 24, 9:56 am, "Martin v. Löwis" <mar... at v.loewis.de> wrote:
> > I don't understand why I'm getting an encode error in python 3.1.
> The default encoding is not relevant here at all. Look at
Thanks for the response. I get US-ASCII for both 2.6 and 3.1:
$ python3.1 1test.py
I can't figure out a way to programatically set the encoding for
sys.stdout. So where does that leave me? python 3.1 won't let me
explicitly encode my unicode string, and python 3.1 implicitly does
the encoding with the wrong codec. And why would any programmer rely
on python 3.1's implicit encoding of unicode strings anyway?
Presumably, different systems will have different encodings for
sys.stdout, some encodings might cause encode errors.
More information about the Python-list