Jump to content

Recommended Posts

Hi, please consider the following simplified code:

 

function show_ajax_result(str)

{

var request = new XMLHttpRequest();

request.open("GET", "query/query_search_product.php?sp=" + str + "&nocache="+new Date().getTime() , true);

request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded;charset=UTF-8;');

 

request.onreadystatechange = function()

{

if ((request.readyState != 4) || (request.status != 200))

{

return;

}

document.getElementById("results").innerHTML = request.responseText;

}

request.send(null);

}

 

 

 

it works fine with pure English chars and numbers, but when it comes with non-English languages like Chinese, Japanese, Korean, Thai etc., some browser(ie9, ie10) doesn't pass the value to a server correctly. It works great with Chrome 23 and Firefox 16 and even Safari. And all the char values of the server and client are set to utf8. And without sending the data through XMLHttpRequest, query with non-English chars works perfectly. How can I have this solved please?

 

 

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/270780-xmlhttprequest-charset-utf-8-issues/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.