I have stored German umlauts like "ßäöü" in my MySQL database which charset is utf-8.
When I get a value like "Straße" from the DB the output is "Stra�e".
When I display this value with utf8_decode(htmlentities()) the output is completely empty " ".
My html header declares already <meta charset="utf-8">
.
How can this issue be solved?
Asked
Active
Viewed 61 times
1

udgru
- 1,277
- 5
- 14
- 26
2 Answers
0
You could try utf8_decode() if you're using PHP, or any similar function in your language.

Hakim
- 1,084
- 11
- 28
0
Your database is utf-8. Whats your table and column's encoding? Check on that with phpmyadmin. The output of htmlentities is empty because you are not passing an utf-8 string to it, which defaults to an empty string from php 5.4+ (believe me, that compatibility-breaking decision caused many bugs..)

Manuel Arwed Schmidt
- 3,376
- 2
- 18
- 28
-
Table and columns are also set to UTF-8 charset. Could you please explain why I am not passing a UTF-8 string? Could the cause be that my column is set to UTF-8 but the column value contains latin chars like "Straße"? – udgru Feb 26 '15 at 15:18
-
Have you changed that after inserting the data? There is also an mysql connection encoding parameter, though it should be UTF-8 with most webservers nowadays by default. – Manuel Arwed Schmidt Feb 26 '15 at 15:20
-
Ofc it could be that you have inserted non-UTF-8 data into the table. In that case you need to convert the charsets or use http://php.net/manual/de/function.mb-detect-encoding.php to detect and change the encoding manually during the output process. – Manuel Arwed Schmidt Feb 26 '15 at 15:25
-
By transfer encoding I meant what could be set with http://php.net/manual/de/function.mysql-set-charset.php . It can be different from the db's, table's and column's setting. – Manuel Arwed Schmidt Feb 26 '15 at 15:31
-
Yes, that's it. I edited "Stra...e" (utf-e encoded) to human readable name "Straße" in phpMyAdmin. I verified it by inserting new utf-8 encoded values which are displayed correctly now. Thank you! – udgru Feb 26 '15 at 15:33
-
Your solution then will be: https://stackoverflow.com/questions/6115612/how-to-convert-an-entire-mysql-database-characterset-and-collation-to-utf-8 – Manuel Arwed Schmidt Feb 26 '15 at 15:35