[I18n-sig] codec aliases
Tamito KAJIYAMA
kajiyama@grad.sccs.chukyo-u.ac.jp
Tue, 12 Dec 2000 06:43:21 +0900
Hi all,
I'm implementing a modularized version of my Japanese codecs
following Marc-Andre's proposal, and am having two problems
regarding to codec aliases.
>>> import codecs
>>> funcs = codecs.lookup("japanese.jis-7")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
LookupError: unknown encoding
>>> funcs = codecs.lookup("japanese.jis_7")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
LookupError: unknown encoding
>>> funcs = codecs.lookup("japanese.iso-2022-jp")
>>> funcs = codecs.lookup("japanese.iso_2022_jp")
>>> funcs = codecs.lookup("japanese.jis-7")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
LookupError: unknown encoding
>>> funcs = codecs.lookup("japanese.jis_7")
>>>
One problem is that the alias "japanese.jis-7" does not work
unless the corresponding original name "japanese.iso-2022-jp"
have been referred once. This is because the alias is defined
by means of getaliases() in japanese/iso_2022_jp.py, and this
module is not imported when the first time the original name is
referred. Is there a work-around for this problem?
The other problem is that hyphens and underscores are
significant in an alias, although they are not in an original
name. A work-around is to define all combinations of hyphens
and underscores for an alias (e.g. defining both
"japanese.jis-7" and "japanese.jis_7"), but this seems not a
good idea for me.
Regards,
--
KAJIYAMA, Tamito <kajiyama@grad.sccs.chukyo-u.ac.jp>