[I18n-sig] Codecs for Big Five and GB 2312

M.-A. Lemburg mal@lemburg.com
Tue, 31 Oct 2000 16:02:28 +0100


"Martin v. Loewis" wrote:
> 
> > If you don't want to bother with importing the codec packages
> > in your application, you can use the sitecustomize.py module
> > to do the imports at startup time.
> 
> I don't think that's an acceptable solution. Having the superuser
> modify sitecustomize.py won't work on most installations.

Point taken.

BTW, I've just had an idea which could help us out: when requesting
a codec you can also specify a package name, e.g. say you
have a codec package "mycodecs" which contains a codec "my_utf_8.py".
Then you can write:

u"abc".encode("mycodecs.my_utf_8")

and the encodings search function will take care of the rest.

Wouldn't this solve at least some of the problems ?

Adding the "import sitecodecs" to site.py would be an additional
help. But it would create naming problems, which would be avoided
by using the above scheme.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/