Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Commonmark migration
Source Link

###Edit:

Edit:

###Edit:

Edit:

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
added 358 characters in body; edited title
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

gettext character encoding problem

I have the following gettext gettext.po file, which has been translated from a .pot file. II am working on a Linux system (OpensuseopenSUSE if it matters), running gettext 0.17.

msgfmt -c transtest_de_DE.po -o transtest.mo

msgfmt -c transtest_de_DE.po -o transtest.mo

I then check the encoding with the "file" command,

file --mime transtest_de_DE.po
transtest_de_DE.po: text/x-po; charset=utf-8

and then install it to my locale folder and run the program after exporting LANGLANG and LC_CTYPELC_CTYPE, I end up with garbage where the two non-asciiASCII chars are.

If I set my terminal encoding to ISO-8859-2ISO-8859-2, rather than UTF-8UTF-8, then I see the two characters correctly.

Looking inside the generated .mo file with a text editor the file appears to be in utf8UTF-8 as well (I can see the symbols if I set my editor encoding to utfUTF-8).

The program is very simple, and it looks like so:

I am installing the .mo file to /usr/share/locale/de_DE/LC_MESSAGES/transstest.mo /usr/share/locale/de_DE/LC_MESSAGES/transstest.mo, and I have exported LC_CTYPELC_CTYPE and LANGLANG as "de_DE".

whereWhere am I going wrong? Why is gettext giving me the wrong encoding (ISO-8859-2) for my strings, rather than the requested (in the .po file) utfUTF-8??

The solution was on this thread here:

Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit)

in Stack Overflow question Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit) and it appears that I needed to explicitly call

gettext character encoding problem

I have the following gettext .po file, which has been translated from a .pot file. I am working on a Linux system (Opensuse if it matters) running gettext 0.17

msgfmt -c transtest_de_DE.po -o transtest.mo

I then check the encoding with the "file" command

file --mime transtest_de_DE.po
transtest_de_DE.po: text/x-po; charset=utf-8

then install it to my locale folder and run the program after exporting LANG and LC_CTYPE, I end up with garbage where the two non-ascii chars are.

If I set my terminal encoding to ISO-8859-2, rather than UTF-8, then I see the two characters correctly.

Looking inside the generated .mo file with a text editor the file appears to be in utf8 as well (I can see the symbols if I set my editor encoding to utf-8).

The program is very simple, and looks like so:

I am installing the .mo file to /usr/share/locale/de_DE/LC_MESSAGES/transstest.mo , and I have exported LC_CTYPE and LANG as "de_DE".

where am I going wrong? Why is gettext giving me the wrong encoding (ISO-8859-2) for my strings, rather than the requested (in the .po file) utf-8??

The solution was on this thread here:

Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit)

and it appears that I needed to explicitly call

gettext character encoding

I have the following gettext.po file, which has been translated from a .pot file. I am working on a Linux system (openSUSE if it matters), running gettext 0.17.

msgfmt -c transtest_de_DE.po -o transtest.mo

I then check the encoding with the "file" command,

file --mime transtest_de_DE.po
transtest_de_DE.po: text/x-po; charset=utf-8

and then install it to my locale folder and run the program after exporting LANG and LC_CTYPE, I end up with garbage where the two non-ASCII chars are.

If I set my terminal encoding to ISO-8859-2, rather than UTF-8, then I see the two characters correctly.

Looking inside the generated .mo file with a text editor the file appears to be in UTF-8 as well (I can see the symbols if I set my editor encoding to UTF-8).

The program is very simple, and it looks like so:

I am installing the .mo file to /usr/share/locale/de_DE/LC_MESSAGES/transstest.mo, and I have exported LC_CTYPE and LANG as "de_DE".

Where am I going wrong? Why is gettext giving me the wrong encoding (ISO-8859-2) for my strings, rather than the requested (in the .po file) UTF-8?

The solution was in Stack Overflow question Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit) and it appears that I needed to explicitly call

deleted 23 characters in body
Source Link
Bill the Lizard
  • 407.5k
  • 213
  • 579
  • 892
Loading
SO wont let me post an answer
Source Link
CodeT
  • 101
  • 1
  • 4
Loading
Source Link
CodeT
  • 101
  • 1
  • 4
Loading
lang-cpp

AltStyle によって変換されたページ (->オリジナル) /