[I18n-sig] IANA names for character set encodings?

Fredrik Lundh fredrik@pythonware.com
Sat, 9 Feb 2002 12:43:46 +0100


mal wrote:
> How large would such an alias dictionary be ? 
> 
> Looking at the IANA listing it seems rather lengthy. What I'm
> worried about is that Python startup time will get worse for
> programs using codecs (I sometimes wish Python had a builtin
> on-disk registry where we could put static data like this).

why split it up in two parts; put common aliases in one table
(latin*, utf*, us-ascii, iso-8858, iso-2022, and perhaps some
more), put that table inside __init__, and change the search
function to:

    1) look for a common aliases in the small table
    2) try importing the module
    3) if import fails, import "aliases", look it up in the
       big table, and try again

in this way, people who use the "true" names and commonly
used aliases won't have to load the big alias table at all.

</F>