Gabriel Lindgren
Gabriel Lindgren

Reputation: 49

Charset UTF-8, Can't solve it

I have a Swedish website where the content is containing ÅÄÖ and I had a problem with inserting those into the mysql table, I fixed it using "alter table tablename convert to character set utf8 collate utf8_swedish_ci". That is working properly but when I set the http charset encoding to UTF-8 then the special characters from the table get this symbol "�". When I remove the http charset the html special characters get weird but not the characters from the table.

I know there are quite many other questions like this on Stackoverflow, but I cannot get it to work.

Upvotes: 0

Views: 356

Answers (2)

frikkievb
frikkievb

Reputation: 481

You can try fixing this by setting the DB connection also to the correct charset.

mysql_set_charset("UTF8");

Upvotes: 1

Tero Kilkanen
Tero Kilkanen

Reputation: 328

You have to also set the character set of the MySQL connection, so that MySQL returns the results encoded with UTF-8.

Setting the character set for the connection can be done with your MySQL connection setup. See http://www.php.net/manual/en/function.mysql-set-charset.php on how to do it.

Upvotes: 0

Related Questions