Issue with utf-8 encoding using PHP + MySQL

Adriana picture Adriana · Nov 10, 2009 · Viewed 59.2k times · Source

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, and utf-8 is okay. However there are question marks instead of some characters on website! The website encoding is also set to utf8 so I dont understand where the problem is.

PHP and HTML files are also set to utf8.

I have no idea...

Answer

Valentin Golev picture Valentin Golev · Nov 10, 2009

try query

SET NAMES utf8

before any query in your application