Are you banging your head trying to figure out how to convert a seemingly invalid UTF-8 value into a valid one? You might be surprised to know that the problem isn’t how PHP interprets the characters, but rather a database connection issue. If the UTF-8 value in question looks valid in the database but does not look right when displayed on a web page, that could mean your database connection settings are not set correctly.
Tag: utf8
Ever get the following error?
- PHP Warning: json_encode() [function.json-encode]: Invalid UTF-8 sequence in argument in…
Then you are in the same boat I was in, and unfortunately for me, the solution wasn’t as straightforward as I thought it was. The problem we are seeing is that the value being encoded to json is not UTF-8 encoded data. PHP function json_encode, unfortunately, will only accept UTF-8 as its parameter.