PHP setlocale, utf-8 or not?

I set the locale zh_TWthrough

sudo locale-gen --purge en_US.UTF-8 zh_TW

And this set of BIG5 codes

locale: zh_TW           directory: /usr/lib/locale/zh_TW
-------------------------------------------------------------------------------
    title | Chinese locale for Taiwan R.O.C.
    email | bug-glibc-locales@gnu.org
 language | Chinese
territory | Taiwan R.O.C.
 revision | 0.2
     date | 2000-08-02
  codeset | BIG5

And I have a simple PHP script

<?php

putenv('LC_ALL=zh_TW');
setlocale(LC_ALL, 'zh_TW');
bindtextdomain("myPHPApp", "./locale");
textdomain("myPHPApp");

echo gettext("hello");

I prepared the mo file (which is in UTF8 ) and placed under

./locale/zh_TW/LC_MESSAGES/myPHPApp.mo 

And it echoreally worked, so what's the point of setting a locale like zh_TW.UTF-8

+4
source share
2 answers

What is the point of installing a locale such as zh_TW.UTF-8?

.[codeset] - . UTF-8 - , - zh_TW ( zh_TW.UTF-8). , locale -a.

, ! linux zh_TW UTF-8, on IBM BIG5 Windows CP950!

+2

, , . zh_TW, , . UTF-8 , , .

* - , Locale zh_TW, - .

, .

+2

Source: https://habr.com/ru/post/1545167/


All Articles