compilemessages invalid multibyte sequence error

616 views
Skip to first unread message

celopes

unread,
Oct 13, 2009, 12:40:34 AM10/13/09
to Django users
I have a django.po file containing:

# 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: 2009-10-12 22:28-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: core/templates/index.html:7
msgid "Currently selected language is"
msgstr "A linguagem atualmente selecionada é"

#: core/templates/index.html:8
msgid "Howdy!"
msgstr "E aí?!"

When I try to compile messages, I get an error like:

processing file django.po in .../locale/pt_br/LC_MESSAGES
.../locale/pt_br/LC_MESSAGES/django.po:25:44: invalid multibyte
sequence
.../locale/pt_br/LC_MESSAGES/django.po:29:12: invalid multibyte
sequence
msgfmt: found 2 fatal errors

The problem is obviously related to any accented characters (in the
excerpt above é and í). If I replace those by their non-accented
counterparts or by &eacute; and &iacute; the compilation works fine
and translation operates normally.

I'm running mac os x 10.6.1 and the accented characters are the result
of me typing using the US International - PC keyboard layout (so, I
press single-quote-e to obtain é; for example).

What am I doing wrong, please?

Thanks,

CE

Bill Freeman

unread,
Oct 13, 2009, 11:45:07 AM10/13/09
to django...@googlegroups.com
This may be a matter of using the correct encoding in the file.
Be sure that the editor that you are using is treating the file as UTF-8.
(I presume from the headers that the compile step is treating the
file as UTF-8, but the editor may not look at that header, and may,
for example, be using latin-1.)

Bill

celopes

unread,
Oct 13, 2009, 2:49:56 PM10/13/09
to Django users
That was it.

Eclipse was treating the file with the default encoding (in my case
MacRoman). As soon as I changed the file properties to UTF-8
compilemessages worked fine (though I did have to fix every single
encoded character in the file).

Thanks for your help.

CE
Reply all
Reply to author
Forward
0 new messages