Finglish
Finglish

Reputation: 9966

Swedish characters in mysql db cause a null result when called for php / html

I have a database setup as utf-8 collation. It contains a table with the same collation which in turn contains a series of varchar variables all in utf-8.

When I try and use the the output of mysql in my html page via the result is null.

Iam making the sql requests with php, using PDO, and the meta tag for the character set is:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Any idea why values containing ä å ö character are returning null?

Upvotes: 2

Views: 773

Answers (1)

Philip G
Philip G

Reputation: 4104

try adding

 mysql_set_charset("UTF8");

After you have connected to the database and choosen database. I too had a similar problem after trying to convert a mysql db from ISO Latin 1 to UTF8 and adding that line did the trick for me!

Also check so that your php file is saved with UTF8 encoding

Upvotes: 2

Related Questions