Marc-Andre Lemburg <m...@egenix.com> added the comment:

R. David Murray wrote:
> 
> R. David Murray <rdmur...@bitdance.com> added the comment:
> 
> Well, my thought was to avoid having multiple charset alias lists in the 
> stdlib, and reusing the one in codecs, which is larger than the one in email, 
> seemed to make sense.  This came up because a bug was reported where email 
> (silently) failed to encode a string because the charset alias, while present 
> in codecs, wasn't present in the email ALIASES table.
> 
> I suppose that as an alternative I could add full support for the IANA 
> aliases list to email.  Email is the most likely place to run in to variant 
> charset aliases anyway.
> 
> If that's the way we go, then this issue should be changed over to covering 
> just updating codecs with the missing aliases, and a new issue opened for 
> adding full IANA alias support to email.

I think it would be useful to have a mapping from the Python
canoncial name (the one the encodings package uses) to the
"preferred MIME name" as referenced in the IANA list:

http://www.iana.org/assignments/character-sets

This mapping could also be added to the encodings package
together with a function that translates a given encoding
name to its canoncial Python name (codec_module_name())
and another one to translate it to the "preferred MIME name"
according to the above list (encoding_mime_name()).

Note that we don't support all the aliases mentioned in the IANA
list because many of the are outdated and some have proved to be
wrong (the aliased encodings are actually different in a few
places). There are also a few encodings in the list which we
don't support at all.

Since we only rarely get requests for supporting new aliases or
encodings, I think it's safe to say that the existing set
is fairly complete from a practical point of view.

----------
title: The email package should defer to the codecs module for all aliases -> 
The email package should defer to the codecs module for   all aliases

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8898>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to