1

中国的网站总是使用 gbk 字符集。我试图从一个站点获取数据:

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>
4

0 回答 0