Strange problems with encoding
Fredrik Lundh
fredrik at pythonware.com
Thu Nov 6 12:07:38 EST 2003
Rudy Schockaert wrote:
> At the end of site.py you can enable a piece of code that sets your
> default encoding to the current locale of your computer:
>
> if 1:
> # Enable to support locale aware default string encodings.
> import locale
> loc = locale.getdefaultlocale()
> if loc[1]:
> encoding = loc[1]
>
> This works great for me.
instead of hacking your Python installation, I suggest using
explicit calls to the "encode" method wherever you need to
convert from Unicode to binary data on the way out.
> P.S. I really need some weeks off so I can read all the available
> documentation ;-)
it shouldn't take you more than 15-20 minutes to learn enough
about Unicode to be able to write Python code that processes
non-ASCII text in a reliable and portable way:
short version:
http://effbot.org/zone/unicode-objects.htm
long version:
http://www.joelonsoftware.com/articles/Unicode.html
</F>
More information about the Python-list
mailing list