I'm dealing with a JSON file that i cannot modify, i have to keep it AS IS.
it contains text, with all the apostrophes converted to 开发者_如何转开发‚Äô
, and other special chars here and there...
what is that? unicode? how can i convert to the regular apostrophe?
i placed already the META tag utf-8 on the header but it doesn't seem to change anything...
What mime type is your JSON response being sent with? (Look in the headers in FireBug or the Developer Console.) It seems that you one of these steps is using a different encoding:
- The JSON string generated by the web server
- The mime type encoding sent along with the response
- The mime type of your HTML page
- The mime type for your JavaScript code
If you supply the community with actual code, or better yet a working reproducible test case, then the community can better help you.
what is that?
It is an attempt to interpret data stored in one character encoding as data stored in a different character encoding.
To ensure everything displays correctly you need to:
- Pick an encoding (UTF-8 is a good bet)
- Store everything in that encoding
- Configure your editor to use it!
- Configure your database (if applicable) to use it!
- Ensure any server side code you use expects UTF-8 input and gives UTF-8 output
- Configure your webserver to include
charset=utf-8
on the Content-Type HTTP header
The W3C has a good introductory article on the subject, which has links to lots of useful further reading at the end.
精彩评论