[Python-Dev] How to add an encoding alias?

Guido van Rossum guido@python.org
Thu, 26 Sep 2002 15:13:15 -0400


In the spambayes project we encountered some mail samples that use an
encoding name ('ansi-x3-4-1968') that's not in encodings/aliases.py.
(At least not until I added it to CVS yesterday.)

I'd like the spambayes code base to be compatible with Python 2.2.1,
so I like to add this one to the list of aliases.

Is there an official API to add an alias, or do I just have to write

  import encodings.aliases
  encodings.aliases.aliases['ansi-x3-4-1968'] = 'ascii'

???

(BTW, there's an alias 'ansi_x3.4_1986' for ASCII.  Was the ASCII
standard renewed in 1986, or is that simply because there are encoding
designators out there in real life that contain a typo?)

--Guido van Rossum (home page: http://www.python.org/~guido/)