Как преобразовать кодировку данных HTTP GET из GBK в UTF8 в Titanium Mobile?

Сайты в Китае всегда используют 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 ответов

Другие вопросы по тегам