i18n issues
Submitted by robot_terror on Thu, 07/12/2007 - 05:29.Character sets, encodings and such can be quite confusing. Working with international clients has taught me the following principals for problem-free "i18n" support:
- Do NOT specify a default character set in:
- httpd.conf (or other conf files / .htaccess files)
- php.ini (or other php conf files)
- DO specify a character set in:
- PHP Header directive --OR--
- HTML META tag
And in /etc/my.cnf:
character-set-server={your default}
character-set-client={your default}
On a case-by-case basis, MySQL can be overridden in the connectionstring to specify utf8 like such in the connection setup portion of thePHP script:
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER_SET 'utf8'");
