Unicode problem

Martin v. Loewis martin at v.loewis.de
Wed Mar 20 16:32:43 EST 2002


gargravarr at whoever.com writes:

> >if you don't tell Python what 8-bit encoding you want
> >to use for a Unicode string, Python will assume ASCII.
> 
> How do I tell Python what 8-bit encoding I want to use ? Can I tell
> Python so I don't have to use encode?

No. Who is this "I" anyway? If there was a way to set it at run-time,
different libraries might compete in setting it to different values.
Explicit is better than implicit: specify an encoding when you use it.

Notice that "iso-8859-1" should not be used in HTML unless it is
declared through the Content-type HTTP header. If you want to generate
XHTML, the default encoding assumed by the receiver will be "utf-8".

Regards,
Martin



More information about the Python-list mailing list