[issue2931] optparse: various problems with unicode and gettext

Alexey Shamrin report at bugs.python.org
Tue May 20 17:42:28 CEST 2008


Alexey Shamrin <shamrin at gmail.com> added the comment:

I've also attached a patch that fixes all these issues and also allows
the word "error" to be translated with gettext.

Regarding the use of `locale.getpreferredencoding` instead of
`sys.getdefaultencoding`. On my system (Windows XP, Russian) I get:

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, locale
>>> sys.getdefaultencoding()
'ascii'
>>> locale.getpreferredencoding()
'cp1251'

Using cp1251 on my system makes much more sense. It's used as a default
encoding everywhere in the system. For example, in Notepad.

----------
keywords: +patch
Added file: http://bugs.python.org/file10387/optparse.py.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2931>
__________________________________


More information about the Python-bugs-list mailing list