New submission from Santhosh Thottingal <santhosh.thottin...@gmail.com>:
locale._parse_localename fails when the locale name is in xx_YY format. For example when the system locale is Malayalam(India), ml_IN we get the following result >>> locale._parse_localename("ml_IN") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/python311/lib/python3.1/locale.py", line 424, in _parse_localename raise ValueError('unknown locale: %s' % localename) ValueError: unknown locale: ml_IN The expected result is ('ml_IN', None) For Latin languages, locale.py assumes iso-8859-15 as the encoding type if encoding type is not given in localename. In case of other locales, None can be returned for encoding type. Attached patch fixes this. The result after applying patch to locale.py >>> import locale >>> locale._parse_localename("ml_IN") ('ml_IN', None) ---------- components: Library (Lib) files: locale.py-parselocale-patch.diff keywords: patch messages: 92546 nosy: santhosh.thottingal severity: normal status: open title: locale._parse_localename fails when localename does not contain encoding information type: crash versions: Python 3.1 Added file: http://bugs.python.org/file14881/locale.py-parselocale-patch.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6895> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com