Answer the question
In order to leave comments, you need to log in
How to fix JSON file encoding?
I have a directory in JSON format. When I embed JSON text through a variable directly into the JS code, then everything is fine, everything works, but if I load it via ajax(POST), from an external file, then for some reason all the Cyrillic text is displayed as question marks.
What encoding should be given to the JSON file in order to have intelligible Russian text? It is not convenient to always flatter the JS code and change the texts.
Answer the question
In order to leave comments, you need to log in
Save the html page itself and scripts in utf8 without BOM.
In html, in head, specify
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
The encoding must match the encoding specified on the page itself with which the response comes, otherwise all ajax responses will use the cast to the default encoding.
Most likely, the sore is treated by adding an HTTP header to the response:
where instead of utf-8 specify the required encoding.
The resulting HTTP response headers can be viewed in the Net tab in FireBug.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question