Opened 22 months ago

Closed 7 months ago

#21928 closed Bug (duplicate)

updating .po files with ' makemessages' under windows with russian locale fail

Reported by: gurovic@… Owned by: nobody
Component: Internationalization Version: 1.7
Severity: Normal Keywords: encoding msgmerge
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by aaugustin)

django1.7, python 3.2, windows 7 64 bit russian

I have Windows 7 Rus, default encoding is cp1251.
If i have some translations in .po-file in russian (utf-8 encoding),
and running makemessages again to add new phrases, it uses msgmerge.exe in function write_po_file,
popen got output in cp1251 encoding instead utf-8 and crashes:

Exception in thread Thread-63:
Traceback (most recent call last):
  File "c:\python32\lib\", line 740, in _bootstrap_inner
  File "c:\python32\lib\", line 693, in run
    self._target(*self._args, **self._kwargs)
  File "c:\python32\lib\", line 1013, in _readerthread
  File "c:\python32\lib\encodings\", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1157: character maps to <undefined>

Traceback (most recent call last):
  File "c:\python32\Scripts\", line 9, in <module>
    load_entry_point('Django==1.7a1', 'console_scripts', 'django-admin')()
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 427, in execute_from_command_line
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 419, in execute
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 337, in execute
    output = self.handle(*args, **options)
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 529, in handle
    return self.handle_noargs(**options)
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\commands\", line 288, in handle_noargs
    self.write_po_file(potfile, locale)
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\commands\", line 399, in write_po_file
    msgs, errors, status = popen_wrapper(args)
  File "c:\python32\lib\site-packages\django-1.7a1-py3.2.egg\django\core\management\", line 25, in popen_wrapper
    output, errors = p.communicate()
  File "c:\python32\lib\", line 813, in communicate
    return self._communicate(input)
  File "c:\python32\lib\", line 1050, in _communicate
    stdout = stdout[0]
IndexError: list index out of range

popen runs for the following process:

['msgmerge', '-q', 'C:\\temp\\oluch\\oluch\\locale\\ru\\LC_MESSAGES\\django.po', 'C:\\temp\\oluch\\oluch\\locale\\django.pot'] 

Change History (8)

comment:1 Changed 22 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Is this a regression from Django 1.6?

comment:2 Changed 22 months ago by aaugustin

  • Description modified (diff)
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 22 months ago by bbaja42

Might be related to #21991, it also had issues regarding locale. If it is related, then it is not regression.

Last edited 9 months ago by timgraham (previous) (diff)

comment:4 Changed 22 months ago by claudep

  • Severity changed from Release blocker to Normal

comment:5 Changed 11 months ago by timgraham

  • Version changed from 1.7-alpha-1 to 1.7

comment:6 Changed 9 months ago by LennyLip

got this bug (

created .po file contains:
"Content-Type: text/plain; charset=UTF-8\n"

Python 3, Django 1.7.3

any news?

comment:7 Changed 8 months ago by martinsvoboda

I also have this bug. Nowadays is not possible for me runs makemessages on Windows, if some translations exist. Msgmerge probably works wrong with encoding on windows.

  • On Unix has similar problem solved with setting locale
  • It is not possible to configure Windows this way. Utf8 cannot be default locale. locale.getdefaultlocale() returns for me:
    >>> locale.getdefaultlocale()
    ('cs_CZ', 'cp1250')

Content in django.po, which raise exception:

#: .\quotes\
msgid "Domain.tld: Quotes for every day"
msgstr " Citáty na každý deň"

Python 3.4.2, Django 1.8, Windows 7 64bit

Last edited 8 months ago by martinsvoboda (previous) (diff)

comment:8 Changed 7 months ago by daphshez

  • Resolution set to duplicate
  • Status changed from new to closed

The regression tests for #23271 now fails for the same reason, so I suggest this discussion should continue there.

Note: See TracTickets for help on using tickets.
Back to Top