[Python-Dev] Unicode howto in the works - feedback appreciated

Fredrik Lundh fredrik@pythonware.com
Wed, 1 May 2002 10:14:43 +0200

Gustavo Niemeyer wrote:
> I'm not sure if this is a common issue with other languages. But at
> least here (brazilian portuguese), this is a little bit inconvenient.
> Fortunately, fixing this is easy, since site.py was nicely prepared
> for this (thanks <author> ;-):
> if 0:
>     # Enable to support locale aware default string encodings.
>     import locale
>     loc = locale.getdefaultlocale()
>     if loc[1]:
>         encoding = loc[1]
> Enabling it should be enough

that's a really great way to write non-portable code, of

please keep your encodings explicit.

(if you're printing lots of stuff, use an encoded stream)