开发者

how to use other encodings with JSON?

开发者 https://www.devze.com 2023-03-30 01:04 出处:网络
I know that JSON_decode only works with UTF-8, 开发者_C百科I want to use characters like this:\"ë\" how can I achieve that? or there is not way?

I know that JSON_decode only works with UTF-8, 开发者_C百科I want to use characters like this:"ë" how can I achieve that? or there is not way?

THANK YOU FOR YOUR TIME AND HELP.


Just encode the character in UTF-8. It looks like you want U+00EB, or as it's called in the Unicode spec: "LATIN SMALL LETTER E WITH DIAERESIS".

In UTF-8 that is two bytes: c3 ab

Or you can use an string escape: "\u00eb"

You should probably also read Joel Spolsky's article The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!).

0

精彩评论

暂无评论...
验证码 换一张
取 消