I'm getting troubles with data from a database containing german umlauts. Basically, whenever I receive a data containing umlauts, it is a black square with an interrogation mark. I solved this by putting
mysql_query ('SET NAMES utf8')
before the query.
The problem is, as soon as I use json_encode(...)
on a result of a query, the value containing an umlaut gets null
. I can see this by calling the php-file directly in the browser. Are there other solution than replacing this characters before encoding to JSON and decoding it in JS?
You probably just want to show the texts somehow in the browser, so one option would be to change the umlauts to HTML entities by using
htmlentities()
.The following test worked for me: