31 Oct
2002
31 Oct
'02
9:34 p.m.
On Thursday 31 October 2002 8:27 pm, Dieter Maurer wrote:
Python uses the "defaultencoding" for such conversions. If it is not specified in "sitecustomize.py", Python uses ASCII encoding. Thus, when you unicode string contains a non-ASCII character, you get the above exception.
As you live in a Western country, you probably should set "sys.setdefaultencoding('iso-8859-1')" in your "sitecustomize.py".
I dont think that is good advice. sys.setdefaultencoding is left over from the early days of python unicode development. It is likely to disappear in future versions of python. Alot of code legitimately assumes the default encoding is ascii, and may break if you change it.