Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] OT-Japanese in PHP



Hi All,

after reading this post,

******
Firstly, your Apache charset settings have no effect on the Charset 
headers produced by PHP (I think).

Secondly, I *STRONGLY* recommend that if you're not using an 8-bit 
character set, you use UTF-8 for everything.

UTF-8 is the way to go. If you don't go there, you will be sorry.

Unfortunately PHP has poor support for encodings, as it doesn't really 
know what a "string" is. As far as PHP is concerned, a string is an 
array of bytes.

This means that functions like strlen() will get the answer wrong, and 
that string-manipulation functions will muck up UTF8 strings.

The solution is to use only the mbstring versions of these functions - 
and if you need to use regular expressions etc, use preg with the utf-8 
flag.

Bear in mind also, that you'll want to write your PHP files in utf8 too 
- make sure the mbstring internal encoding is set to utf8.

PHP really sucks for multibyte character set applications. It was 
designed by some Europeans who didn't understand what character 
encodings were (and couldn't see past ISO-8859-* anyway)
******

from a php forum, I changed my settings in php.ini to render UTF-8 
including changing the database field that contained Japanese to UTF-8 
and it displays fine in phpmyadmin. I then changed charset to UTF-8 in 
the php page, but, it still won't display J from the database. Anyone 
got a solution, apart from giving up, which I detest..? Cheers.

Mark Sargent.


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links