如何在Titanium Mobile中将HTTP GET数据的字符集从GBK转换为UTF8?

时间:2013-11-03 13:39:13

标签: javascript character-encoding titanium gbk

中国的网站总是使用gbk charset。我试图从网站获取数据:

var url = "http://nga.178.com/thread.php?fid=7";
var client = Ti.Network.createHTTPClient({
    // function called when the response data is available
    onload : function(e) {
        Ti.API.info("Received text: " + this.responseText);
        alert('success');
    },
    // function called when an error occurs, including a timeout
    onerror : function(e) {
        Ti.API.debug(e.error);
        alert(e.error + client.status);


        Ti.API.debug(client.responseText);
    },
    timeout : 50000 // in milliseconds
});
// Prepare the connection.
client.open("GET",url);
// Send the request.

client.send();

但是回复:

[DEBUG] :  <title>ÌáʾÐÅÏ¢</title>

0 个答案:

没有答案