rg3 <sarbalap+freshm...@gmail.com> added the comment:

I don't know if the behavior is considered a bug or just undocumented, but 
under Python 2.7.3 it's still the same. locale.getpreferredencoding() does 
return UTF-8, but the second element in the tuple locale.getdefaultlocale() is 
"utf_8_valencia", which is not a valid encoding despite the documentation 
saying it's supposed to be an encoding name.

>From my terminal:

$ python -V
Python 2.7.3

$ LANG=ca_ES.UTF-8@valencia python -c 'import locale; print 
locale.getpreferredencoding()'
UTF-8

$ LANG=ca_ES.UTF-8@valencia python -c 'import locale; print 
locale.getdefaultlocale()'
('ca_ES', 'utf_8_valencia')

$ LANG=ca_ES.UTF-8 python -c 'import locale; print 
locale.getpreferredencoding()'
UTF-8

$ LANG=ca_ES.UTF-8 python -c 'import locale; print locale.getdefaultlocale()'
('ca_ES', 'UTF-8')

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5815>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to