开发者

How can i set XMLHttpRequest to support Unicode when it pass data by QueryString?

I use regular XmlHttlRequest, everything work fine except the unicode. How can i set that the query string will support unicode, (right now it return to c# '??????' when i pass unicode character (Hebrew)). I've tried to set the globalization setting to UTF-16 or Unicode in the web.config like this:

But it still pass '????'.

I attach pic of my code although its a XmlHttpRequest regular code like开发者_JAVA技巧 everyone know.

Thank you!

How can i set XMLHttpRequest to support Unicode when it pass data by QueryString?


XMLHttpRequest won't modify URLs (other than removing invalid characters), you have to build the correct URL yourself. That's what encodeURIComponent function is good for:

xmlRequest.open("GET", "foo.apx?name=" + encodeURIComponent(name));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜