如何强制XMLHtt prequest仅使用IS​​O-8859-1字符集? [英] How to force XMLHttpRequest to use ISO-8859-1 charset only?

查看:152
本文介绍了如何强制XMLHtt prequest仅使用IS​​O-8859-1字符集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ISO-8859-1的数据库,所以我想在这个codePAGE完全交换请求。那么,如何设置内容类型以正确的方式AJAX请求?

I have ISO-8859-1 database, so I like to exchange requests entirely in this codepage. So, how to set content-type for AJAX requests in the right way?

推荐答案

尽管这是不好做(一堆上述意见),这会工作:

Even though it's bad to do (bunch of comments above), this would work:

var xhr = new XMLHttpRequest(); 
xhr.open("GET", path, false);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=ISO-8859-1')

如果你正在使用jQuery: http://stackoverflow.com/a/553572/2527433

If you are using jQuery: http://stackoverflow.com/a/553572/2527433

这篇关于如何强制XMLHtt prequest仅使用IS​​O-8859-1字符集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆