1
otakustay 2015-06-15 16:36:04 +08:00
远端返回的时候在Content-Type头里加上charset应该就行了的
|
4
imn1 2015-06-15 16:50:27 +08:00
如果自己有后台环境,可以用后台做个跳板,js连接后台某个程序,这个程序把远端接收转码
|
5
oott123 2015-06-15 16:54:55 +08:00
https://www.npmjs.com/package/iconv-lite
Convert character encodings in pure javascript. In-browser usage via Browserify (~180k gzip compressed with Buffer shim included). |
6
tux 2015-06-15 18:21:14 +08:00
document.charset='gb2312';
|
7
iahu 2015-06-16 10:08:28 +08:00 1
var rstr2utf8 = function (input) {
var output = ""; for (var n = 0; n < input.length; n++) { var c = input.charCodeAt(n); if (c < 128) { output += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { output += String.fromCharCode((c >> 6) | 192); output += String.fromCharCode((c & 63) | 128); } else { output += String.fromCharCode((c >> 12) | 224); output += String.fromCharCode(((c >> 6) & 63) | 128); output += String.fromCharCode((c & 63) | 128); } } return output; } |