UTF8 Problem, incorrect display of special characters… (é, É, å, ä, ö etc.)

Are you still facing problem, when display the special characters…(£,é, É, å, ä, ö etc.) ? Here is the solution to fix the issue.

Firstly, make sure that your database table is set to character set UTF-8. So you must create the database, with UTF-8 encoding.

Create a new database, with UTF-8 encoding

Or If you have created the database already, you need to convert it to UTF-8 encoding

First, backup! and alter the database. This does not convert existing tables, it only sets the UTF-8 for newly created tables.

Then, you will need to convert the char set on all existing tables and their columns.  This assumes that your current data is actually in the current char set.

Now the table columns are set to UTF-8 char set but your data is really stored in another then you will need to check the MySQL manual on how to handle this. Normally I insert / update the data again at this occasion.

Secondly, Make sure you set the charset=’utf8′ in your database connection object. This should be done before querying the database.

Make sure your website completely UTF-8 friendly.



Also, note that the the <form> element has an ‘accept-charset’ attribute which should also be set:

Now everything must work as expected! Get a £ character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF8.


Be the first to comment

Leave a Reply

Your email address will not be published.