[New-bugs-announce] [issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.

umedoblock report at bugs.python.org
Fri Feb 8 02:31:18 CET 2013


New submission from umedoblock:

I'd like to parse _('こんにちは').
However pygettext.py doesn't parse _('こんにちは').
pygettext.py said me 'IndexError'.
now I attached pygettext.py.patch to fix a bug.
I show you command history.

$ pygettext.py -o - --verbose konnichiha.py
...
#: konnichiha.py:6
msgid "konnichiha"
msgstr ""

#: konnichiha.py:7
Traceback (most recent call last):
  File "/home/umetaro/local/bin/pygettext.py", line 664, in <module>
    main()
  File "/home/umetaro/local/bin/pygettext.py", line 657, in main
    eater.write(fp)
  File "/home/umetaro/local/bin/pygettext.py", line 497, in write
    print('msgid', normalize(k), file=fp)
  File "/home/umetaro/local/bin/pygettext.py", line 250, in normalize
    s = '"' + escape(s) + '"'
  File "/home/umetaro/local/bin/pygettext.py", line 236, in escape
    s[i] = escapes[ord(s[i])]
IndexError: list index out of range

please use pygettext.py.patch.

$ pygettext.py -o - --verbose konnichiha.py
...
#: konnichiha.py:6
msgid "konnichiha"
msgstr ""

#: konnichiha.py:7
msgid "こんにちは"
msgstr ""

----------
components: Demos and Tools
files: konnichiha.py
messages: 181651
nosy: umedoblock
priority: normal
severity: normal
status: open
title: Tools/i18n/pygettext.py doesn't parse unicode string.
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file28991/konnichiha.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17156>
_______________________________________


More information about the New-bugs-announce mailing list