locale.setlocale() shoud use a tuple rather than a string.

Issue #731 resolved
Former user created an issue

I found a problem in l10n/utils.py/get_locale_conv (). The code calls locale.setlocale() with a string parameter returned by locale.normalize(loc), which returns inconsistent values. For example, locale.normalize('ja') returns 'ja-JP.EUC-JP' even on UTF-8 system (ubuntu 8.10). As a result, the system crashes.

As of Python 2.0, setlocale() allows passing a tuple (lang,encoding) instead of a string. I modified the code to pass a tuple (loc,'utf-8'), and it started working as expected. It should be simpler than the current code base.

Reported by hnak

Comments (3)

  1. Former user Account Deleted

    I tested some systems with 'ja' locale.

    Ubuntu 8.10 : ('ja','utf-8') worksBR Mac OS X 10.5 : ('ja',None) worksBR NetBSD 4.01 : ('ja',None) worksBR Windows Vista : None works.

  2. Log in to comment