Character Encoding From UTF8 JSON To ISO-8859-1
Solution 1:
There is no need to escape or decode any characters in data transmitted in JSON. It's done automatically. It is also independent of the page's encoding. You can easily transmit and display the euro sign (\u20ac
) with your code even though ISO-8859-1 does not contain the euro sign.
You problem are the characters \u0091
and \u0092
. They aren't valid Unicode characters. They are for private use only.
It rather looks as if you in fact have data that originally used the Windows-1250 character set but was not properly translated to Unicode/JSON. In Windows-1250, these two characters are typographic single quotes.
Solution 2:
Did you tried without utf8_decode ?
If the characters in your string exist in ISO-8859-1, this will just work, as Javascript decodes the \u0091
in the encoding of the page.
Post a Comment for "Character Encoding From UTF8 JSON To ISO-8859-1"