hi,i moved data from mysql 4 (they were originally set to latin2 encoding) to mysql 5 and set encoding to utf-8. It looks good in phpMyAdmin, utf-8 is ok. But there are question marks instead of some characters on website! website encoding is also set to utf8 so i dont understand where is the problem. PHP and HTML files are also set to utf8. I have no idea ...
|
try query SET NAMES utf8 before any query in your application |
|||||||||
|
Try setting the MySQL connection to UTF-8:
And send explicit UTF-8 headers, just in case your server has some other default settings:
|
|||
|
You don't have to set your PHP and HTML files to utf-8. You just have to set your output encoding to UTF-8 and the browser will display appropriately. In HTML:
In PHP:
When you get a string that is UTF-8 from the MySQL table, it will be UTF-8 all the way to browser output unless you convert the encoding. It's the way that the browser inteprets it. |
|||||
|
I had this problem recently (I hope its the same problem you are having), I tried many ways but at the end what worked was really simple. Convert your dumped SQL file to UTF-8 format and then import it. BW: I used Notepad++ for the conversion. |
|||
|
Put .htaccess file in your web-site root with content: AddDefaultCharset UTF-8 and in your dbconfig set after connection to db: mysql_query("SET NAMES 'utf8'"); |
|||
|