1 |
I'm translating a web page from English to Spanish using gettext, but I'm having problems with UTF-8. |
2 |
|
3 |
The problem: |
4 |
All my web pages translated with gettext declare themselves as UTF-8 encoding but it is actually iso-8859-1 (latin-1). |
5 |
I reach that conclusion using Firefox to enforce the encoding the page is viewed in. Firefox detects page encoding as UTF-8 but displays boxes instead of regular characters. If I force Firefox to use iso-8859-1 the characters are displayed correctly. |
6 |
Text from web pages wich have not been translated with gettext is displayed correctly with UTF-8 encoding, so I'm sure it's a gettext problem. |
7 |
|
8 |
Te question: |
9 |
Why msgfmt generates de .mo file in iso-8859-1 and not in UTF-8? How can I solve it? |
10 |
|
11 |
If it helps: |
12 |
-All my source files (*.php) are in UTF-8. |
13 |
|
14 |
-APACHE is set to use UTF-8 by default UTF-8 (AddDefaultCharset UTF-8) |
15 |
|
16 |
-My .po file is in UTF-8: |
17 |
# file locale/es_ES/messages.po |
18 |
locale/es_ES/messages.po: UTF-8 Unicode PO (gettext message catalogue) text |
19 |
|
20 |
-I've set charset to UTF-8 in the .po header: |
21 |
# grep charset locale/es_ES/messages.po |
22 |
"Content-Type: text/plain; charset=UTF-8\n" |
23 |
|
24 |
|
25 |
And the commands I've used to generate the .pot,.po and .mo files are: |
26 |
# mkdir -p locale/es_ES/LC_MESSAGES/ |
27 |
# xgettext --indent --no-wrap --sort-by-file --from-code=UTF-8 --output locale/messages.pot *.php |
28 |
# cp locale/messages.pot locale/es_ES/messages.po |
29 |
# msgfmt --verbose --output-file locale/es_ES/LC_MESSAGES/messages.mo locale/es_ES/messages.po |
30 |
|
31 |
|
32 |
T.I.A |
33 |
-- |
34 |
gentoo-user@g.o mailing list |