How to set the sjis environment for PHP5.1 and MySQL4.1
[email protected] ("Kiyoshi Inoue")
| Newsgroups | php.i18n |
|---|---|
| Message-ID | <[email protected]> |
It seems to me that PHP5.1.1 doesn't go well with MySQL 4.1.16
in handling 2 byte sjis coded japanese character.
SET NAMES 'sjis' command doesn't work in the following PHP script.
Before and afer this command, the current characer set remains the same as
latin1-swedish, while server and databese character set are set to sjis.
I've been struggling in vain to resolve this mojibake problem.
$link = mysql_connect('localhost', 'sampuser', 'tbnq0206')
OR die(mysql_error());
$charset = mysql_client_encoding($link);
echo "The current character set is : $charset\n";
mysql_query("SET NAMES 'sjis'", $link);
$charset = mysql_client_encoding($link);
echo "The current character set is : $charset\n";
Cheers,
Kiyoshi Inoue