#22880: UnicodeDecode error when running `makemessages` (python 3.4.1)
--------------------------------------------+------------------------
     Reporter:  valberg                     |      Owner:  nobody
         Type:  Uncategorized               |     Status:  new
    Component:  Core (Management commands)  |    Version:  1.7-beta-2
     Severity:  Normal                      |   Keywords:
 Triage Stage:  Unreviewed                  |  Has patch:  0
Easy pickings:  0                           |      UI/UX:  0
--------------------------------------------+------------------------
 Made this model for testing:

 {{{#!python
 from django.db import models
 from django.utils.translation import ugettext_lazy as _


 class Foo(models.Model):
     bar = models.CharField(
         verbose_name=_('bar'),
         max_length=255
     )
 }}}

 `django-admin makemessages -l da` creates the following `django.po` file:

 {{{#!po
 $ cat locale/da/LC_MESSAGES/django.po
 # SOME DESCRIPTIVE TITLE.
 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
 # This file is distributed under the same license as the PACKAGE package.
 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
 #
 #, fuzzy
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2014-06-22 19:49+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <[email protected]>\n"
 "Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"

 #: models.py:7
 msgid "bar"
 msgstr ""
 }}}

 Changing the last line (doing the translation of "bar") to this:

 {{{#!po
 msgstr "æøå"
 }}}

 Results in this error when running `django-admin makemessages -l da`
 again:

 {{{
 processing locale da
 Traceback (most recent call last):
   File "./../manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/__init__.py", line 377, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/base.py", line 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/base.py", line 337, in execute
     output = self.handle(*args, **options)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/base.py", line 532, in handle
     return self.handle_noargs(**options)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/commands/makemessages.py", line 295, in
 handle_noargs
     self.write_po_file(potfile, locale)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/commands/makemessages.py", line 397, in
 write_po_file
     msgs, errors, status = popen_wrapper(args)
   File "/Users/valberg/.virtualenvs/django17/lib/python3.4/site-
 packages/django/core/management/utils.py", line 25, in popen_wrapper
     output, errors = p.communicate()
   File "/Users/valberg/.pyenv/versions/3.4.1/lib/python3.4/subprocess.py",
 line 959, in communicate
     stdout, stderr = self._communicate(input, endtime, timeout)
   File "/Users/valberg/.pyenv/versions/3.4.1/lib/python3.4/subprocess.py",
 line 1658, in _communicate
     self.stdout.encoding)
   File "/Users/valberg/.pyenv/versions/3.4.1/lib/python3.4/subprocess.py",
 line 887, in _translate_newlines
     data = data.decode(encoding)
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 663:
 ordinal not in range(128)
 }}}

 I'm not sure whether this is a django error or a python one.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22880>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.5d8e460a4171bbd2584b0c0af02e9bd6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to