[Python-bugs-list] [ python-Bugs-678259 ] locale.getpreferredencoding fails on AIX

SourceForge.net noreply@sourceforge.net
Thu, 20 Mar 2003 19:28:20 -0800


Bugs item #678259, was opened at 2003-01-31 13:01
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=678259&group_id=5470

Category: Extension Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: Martin v. Löwis (loewis)
Summary: locale.getpreferredencoding fails on AIX

Initial Comment:

The problem is setting LC_CTYPE to an empty string:

>>> locale.setlocale(locale.LC_CTYPE, '')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/neal/python/dist/aix/Lib/locale.py", line 
381, in setlocale
    return _setlocale(category, locale)
locale.Error: locale setting not supported

Putting a try/except around the setlocale call in 
getpreferredencoding allows the test to pass.  I don't 
know if this is correct.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-03-20 22:28

Message:
Logged In: YES 
user_id=33168

The problem was that the setlocale in Lib/locale.py was
being used, not from Modules/_localemodule.c.  In the python
version, it does not allow an empty string.  Seems like this
should be changed, do you agree?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2003-03-03 18:11

Message:
Logged In: YES 
user_id=21627

What are the relevant environment settings? According to

http://nscp.upenn.edu/aix4.3html/libs/basetrf2/setlocale.htm

specifying "" as the second argument of setlocale is
supported, and means the same thing as it does on all other
systems: take locale settings from the user preferences.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=678259&group_id=5470