UTF-8 problems with MySQL
Posted: Mon Feb 28, 2011 7:50 pm
Hi,
Very briefly, I seem to have a problem displaying UTF-8 characters retrieved from my MySQL database.
I have my shared hosting package with PHP set-up to use UTF-8 by declaring the following at the top of my scripts:
I also include the following line in my HTML template:
On the MySQL side of things, the collation is set to UTF-8 for both the database itself and individual fields. When I enter a special character (my test character is é) this displays correctly inside phpMyAdmin (which proves that MySQL is saving it properly) but when the same text is retrieved from my script I get the question mark symbol; this leads me to conclude that the problem is obviously to do with my script 
Could anyone offer any advice please - am I declaring the right ini_set() values? Do I need to declare more? My multibyte extension settings are:
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value
Thanks,
M_G
Very briefly, I seem to have a problem displaying UTF-8 characters retrieved from my MySQL database.
I have my shared hosting package with PHP set-up to use UTF-8 by declaring the following at the top of my scripts:
Code: Select all
ini_set('default_charset', 'UTF-8');Code: Select all
<meta http-equiv="content-type" content="text/html; charset=utf-8" />Could anyone offer any advice please - am I declaring the right ini_set() values? Do I need to declare more? My multibyte extension settings are:
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value
Thanks,
M_G