içerik türü metin/html, text/plain değilken karakter kümesinin nasıl ayarlanacağını anlamakta güçlük çekiyorum veya text/xml, bunun yerine application/x-www-form-urlencoded içerik türü.ajax, setRequestHeader(), Content-Type, application/x-www-biçimli-urlencoded ve charset
Verilen bu (basitleştirilmiş) javascript kodu:
var xhr = new XMLHttpRequest();
Ben
xhr.open('POST', 'serv.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
firebug içerik türü "olduğunu söylüyor, değil açıkça kodlamasını ayarlamak yapmak Eğer application/x -www-form-urlencoded; charset = UTF-8. "
Ben mesela ISO-8859-1 için charset ayarlarsanız, hala söylüyor
xhr.open('POST', 'serv.php', true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
firebug "application/x-www-form-urlencoded; charset = UTF-8. " Ben
xhr.setRequestHeader('Content-Type', 'text/plain; charset=ISO-8859-1');
gibi bir şey denerseniz
o zaman charset saygı gösterir.
Her durumdasend() yöntemi şöyledir:
xhr.send('id=9&name=Yoda');
Neden Content-Type x-www-form-urlencoded olup olmadığını belirlemek charset dikkate almaz?
NOT: ISO-8859-1'i örnek olarak kullanıyorum. Amacım neler olup bittiğini anlamak.