I’m getting crazy over these encoding probs…
I use json_decode and json_encode to store and retrieve data. What I did find out is, that json always needs utf-8. No problem there. I give json ‘hellö’ in utf-8, in my DB it looks like hellu00f6. Ok, codepoint. But when I use json_decode, it won’t decode the codepoint back, so I still have hellu00f6.
Also, in php 5.2.13 it seems like there are still no optionial tags in JSON. How can I convert the codepoint caracters back to the correct specialcharacter for display in the browser?
Greetz and thanks
Maenny
It could be because of the backslash preceding the codepoint in the JSON unicode string:
öis represented\u00f6. When stored in your DB, the DBMS doesn’t knows how to interpret\u00f6so I guess it reads (and store) it asu00f6.Are you using an escaping function ?
Try adding a backslash on unicode-escaped chars: