UTF templates retrieved with AJAX not showing up in Safari

I have a problem rendering content received through Ajax to my HTML page in Safari (v.4). The page is stored in UTF-8, the Ajax response is also encoded in UTF-8.

The downloaded content is analyzed, and then various types of lists are filled with the analyzed data. One of them is a simple <select>, where the parameter text is set using trivial code:

option.innerHTML = "";
option.appendChild(document.createTextNode(text));

There are french characters in my text. As a result of the code above, select> the element shows a variant with this French text, divided into 2 parts, where the separator (some kind of cool French letter) does not appear at all ...: (

Using

option.innerHTML = escapeGtLtAmp(text);

has the same result.

If the French content is set to innerHTML of some <div> then the text will be displayed not broken, but simply with non-English letters omitted.

In Firefox 2, everything works fine.

+3
source share
2 answers

The page is stored in UTF-8, the Ajax response is also encoded in UTF-8.

Does the AJAX response also have a Content-Type-HTTP header set to UTF-8?

0
source

I had a similar problem with Firefox 3, and it seems the problem was ajax call. I also tried changing the request headers, but the problem continued. So I tried loading the data from the iframe, thereby completely avoiding ajax, and then getting the iframe innerHTML.

jquery,

0

Source: https://habr.com/ru/post/1710831/


All Articles