Unicode string output

M.-A. Lemburg mal at lemburg.com
Thu Jan 25 08:08:32 EST 2001


Boudewijn Rempt wrote:
> 
> On Thu, 25 Jan 2001, M.-A. Lemburg wrote:
> 
> >
> > Why would you want to set the encoding on a per application
> > basis, BTW ?
> >
> 
> Because some applications work with Unicode, others with latin-1,
> and others again with sjis, for instance. I don't want to have
> to explicitly select an encoding throughout the whole application,
> that just opens up more possibilities for bugs. I might want Zope
> to use a default of latin-1 (perhaps - I don't know much about
> Zope), but Kura needs utf-8.
> 
> Another thing with a system-wide standard is the different
> preferences of users. I need Unicode and Latin-1, but my wife,
> who uses the same machine needs latin-1 and koi-8.

Well, you can manage multi-user settings easily by providing
a special sitecustomize.py module, so I guess that's a non-issue.

The problem with having a per application setting for the
default encoding is that this would cause code to be written which
may rely on one specific default encoding. It is much better
to write such assumption into the code itself than to rely on
default settings.

I agree though, that we will need to put some more work into
making streams and other interfaces more Unicode aware and to
simplify those interfaces. In theory you could e.g. redirect
stdin and stdout through codecs, but in practice this currently
doesn't work well together with "print" due to the complicated
machinery in the Python interpreter.

The same goes for making the Python standard lib more Unicode
aware. There's still a lot to do ... we could need some sponsors :)

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/




More information about the Python-list mailing list