I need to send data to the server using the character set Big-5, however the browser seems to only encode the data in UTF-8. If I were to make a form, then it can be achieveable with the following attribute:
<form accept-charset="Big5">
However, I want to send the data through XHR. Some answers suggest that contentType
can let me change it. But according to jQuery's documentation, the encoding cannot be overridden: (at least this is true in Chrome.)
The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding.
$.ajax({
url: "dummy url",
type: "GET",
data: {
q: "Test"
},
contentType: "application/x-www-form-urlencoded;charset=Big5"
}, function(){});
//This won't work.
Is there any way to get around it?