views:

193

answers:

2

What is the best Collation for the column that can allow to store accented letters and parse them out perfectly without any encoding error, because whenever I add an accented letter such as é, å, it shows out with an encoding problem on the PHP side, but in the MySQL side it's fine...

How do I get the accented letters display properly?

A: 

Perhaps your problem isn't within the database, but within however you're displaying things from PHP? What content encoding are you specifying in your output? You might need to manually send a header to specify that the content is UTF-8 if that's what you're trying to output.

For instance: header("Content-Type: text/html; charset=UTF-8");

Amber
I already have the <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> set. But it doesn't seem to work anyway. The field collation is VARCHAR and latin1_swedish_ci
YouBook
A: 

You get them correctly by matching the encoding on both ends, ie. both your PHP output and your DB should use the same encoding. For European languages I would suggest using UTF-8 for both your scripts and the DB. Just remember that you still have to initialize UTF-8 collation in MySQL using SET NAMES 'utf8' COLLATE 'utf8_general_ci' (so run this query just after you make a connection to the DB and you should be ok).

wimvds