0

I am using gettext _('someString') to do i18n, and it is working fine in my windows dev XAMPP platform;

However, when I upload to a Linux CentOS hosting, my program display the translated in non utf-8 string.

For example, in Chinese version, it displays �Τ� instead of 用戶 (browser encoding is UTF8)

I can see the label is 用戶, if I change the browser encoding to BIG5.

here is my messages.po file (ANSI as UTF-8):

msgid ""
msgstr ""
"Project-Id-Version: ERP\n"
"POT-Creation-Date: 2014-04-25 14:50+0800\n"
"PO-Revision-Date: 2014-04-28 09:50+0800\n"
"Language-Team: \n"
"Language: zh_HK\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.5.7\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: C:\xampp\test.php:34
msgid "User"
msgstr "用戶"

thank you so much

Garrick
  • 1
  • 2

1 Answers1

0

I finally find the solution. In Linux, the locale folder must be zh_HK.ut8 (I was using zh_HK), because the linux has 3 similar locales: zh_HK zh_HK.big5hkscs zh_HK.utf8

http://php.net/manual/en/book.gettext.php#91187

Garrick
  • 1
  • 2