[issue32781] lzh_tw is missing in locale.py

INADA Naoki report at bugs.python.org
Tue Feb 6 04:39:42 EST 2018


INADA Naoki <songofacandy at gmail.com> added the comment:

> But even so, I think this bug is still valid, as the lzh_TW does not exist in the lib at all.

Python doesn't have locale database, while have some aliases.
Python uses libc's locale.

This exception is raised because `_parse_localename` doesn't support
locale name without encoding.

In case of zh_TW, alias is registered:

    'zh_tw':                                'zh_TW.big5',

But I don't think adding `lzh_tw` to alias is good idea.
There are no "one right alias table".  In case of zh_tw, you may
want zh_TW.UTF-8 rather than zh_TW.bit5, don't you?

So I think supporting locale name without encoding is right way.
Maybe, we should return None for encoding in such situation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32781>
_______________________________________


More information about the Python-bugs-list mailing list