Re: Multiple char encodings for site internationalzation
| From: | Hironori Sato | Date: | Thu, 05 Aug 1999 08:22:47 +0000 |
| Subject: | Re: Multiple char encodings for site internationalzation | ||
| References: | 1 2 3 4 5 6 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-9551@lists.php.net to get a copy of this message | ||
At 22:30 99/8/4 -0400, Chuck Hagenbuch wrote:
>>Hmmm, instead of throwing large utf-8 table into PHP distribution, would it
>>be nicer to have some sort of 'language module' for each language? If one
>>needs Japanese support, use 'Japanese module', people in need of Russian
>>can grab 'Russian module', and so on. Just an idea.
>What about apps that have to deal with lots of encodings, and never know
>which in advance? Eg, webmail - you want to be able to display multiple
>charsets in one email, if necessary, and you don't want to have to choose
>which charsets your system will handle at php compile time...
Good point. It's difficult handle multiple charset without knowing which
locale you are expecting. Thus, you need to know at least the locale in
advance. Good example is EUC encoding. Japanese has EUC_JP, and Chinese
has EUC_CN. (I think there is one more EUC for traditional Chinese and
another one for Korean) They are using similar encoding method, thus you
can not easily detect one from another. Only way to detect the difference
between EUC_JP and EUC_CN might be analyzing the text to see if it's
Chinese or Japanese. Which, unfortunately, is not practical. My guess is
that iso-8859-5 (russian) and iso-8859-6 (arabic) may have similarity which
may be difficult to distinguish each other. Correct me if I'm wrong.
So, if one wants to design a system which can accommadate all sorts of
charset, locale should be defined somewhere on the server side. The only
solution that I can think of is to define the locale for each language. An
example would be setting up virtual server like this:
<VirtualHost chinese.blah.com>
ServerName chinese.blah.com
...
php_i18n_locale cn_cn (or however you define chinese locale)
</VirtualHost>
<VirtualHost japanese.blah.com>
ServerName japanese.blah.com
...
php_i18n_locale ja_jp
</VirtualHost>
may be there is nicer way to handle this, any ideas?
Due to the fact that server needs to know the locale in advance, defining
locale in php file just don't cut it. I guess you can definine it on the
first line of php script, but I think that's pretty cumbersome.
The charset conversion used for Japanese PHP works quite nicely. The
'filtering engine' written by Mr. Kanemoto fits nicely into PHP engine, and
so far, it's proven to work very well. For the PHP users, all they have to
do is set the input/output encoding in php3.ini and be done with it. I
think this is the best way to handle various charset for any given locale.
Any comments are welcome! :)
Hiro
//--- Hironori Sato --------------------------------------- KB9HAD ---
// satoh@jpnnet.com http://staff.jpnnet.com/satoh/
// Japanese Network http://www.jpnnet.com/