D
D
dmitriykardash2012-07-26 18:25:09
PHP
dmitriykardash, 2012-07-26 18:25:09

How to fix encoding in AJAX? "Static" given in the correct encoding?

In standard Wordpress, when adding an entry (ajax request), the entry is displayed with cracks (incorrect encoding, see screenshot, after refreshing the page, the encoding becomes normal. See screenshot2
adding to .htaccess
AddDefaultCharset utf-8
AddType "text/html; charset=utf-8" . html

does not solve the problem, the encoding is wrong only for AJAX requests.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Anatoly, 2012-07-26
@taliban

1. check the Apache encoding
2. check the encoding of the page itself and the files where the source codes are located
3. check the encoding of the page itself by setting it by force or by checking that the browser has set it exactly
4. check the encoding of the file that sends the ajax request

A
Alexander, 2012-07-27
@kryoz

You can explicitly specify the encoding for an ajax request from jquery in the parameters of the ajax function

scriptCharset: "utf-8"

D
dmitriykardash, 2012-07-26
@dmitriykardash

I checked that the page is rendered in utf-8, which is understandable, since after updating it with F5 everything falls into place, but it’s the AJAX response in
Connection:keep-alive
Content-Type:text/xml;charset=windows-1251
Date: Thu, 26 Jul 2012 15:44:07 GMT
Server:nginx/1.0.6
Added to .htaccess
AddType "text/xml; charset=utf-8" .xml
didn't help

M
mrspd, 2012-07-27
@mrspd

Where does Ajax generate the answer from?

S
SKiPP, 2012-10-20
@SKiPP

added this to .htaccess, it started
AddDefaultCharset UTF-8

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question