sys.setedefaultencoding()

Martin v. Löwis martin at v.loewis.de
Sat Jul 5 04:07:47 EDT 2003


"Batista, Facundo" <FBatista at uniFON.com.ar> writes:

> Why? I *always* work with this type of enconding (I live in Argentina).

What type of encoding is "this"? If you are using ISO-8859-1, and you
want to print a Unicode string S to stdout, you should do this

print S.encode("iso-8859-1")

instead of trying this

print S

and hoping that the system default encoding will be ISO-8859-1.

So you should always use implicit conversions, and never implicit
ones, when it comes to encodings.

Regards,
Martin




More information about the Python-list mailing list