programming.name Posted November 16, 2012 Share Posted November 16, 2012 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.