Travel

Categories

PHP & MySQL 5 中文字亂碼

Try to specify the character set to utf8. Unlike MySQL 4 which use Latin1 as the default character set, MySQL 5 use utf8

mysql_query(‘SET NAMES utf8’);
mysql_query(‘SET CHARACTER_SET_CLIENT=utf8’);
mysql_query(‘SET CHARACTER_SET_RESULTS=utf8’);
$rs = mysql_query($query_rsContent, $localhost) or die(mysql_error());

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>