Overview
The result of Titanium.Network.responseXML string is garbled characters when charset is not utf-8.
Sample Code
I make sample xml (charset is Shift_JIS) on my website.
var xhr = Titanium.Network.createHTTPClient();
xhr.open('GET','http://kangaechu.com/xml/shiftjis.xml');
//xhr.open('GET','http://kangaechu.com/xml/utf-8.xml');
xhr.onload = function(){
//Ti.API.info(this.responseText);
var titles = this.responseXML.getElementsByTagName('title');
Ti.API.info(titles.length);
for (var i=0; i<titles.length; i++){
Ti.API.info(i + " : " + titles.item(i).textContent);
}
};
xhr.onerror = function(error){
Ti.API.error(error.toString());
};
xhr.send();
Result
Excepted:
{quote}
I/TiAPI ( 1844): 0 : hello
I/TiAPI ( 1844): 1 : こんにちわ
{quote}
Result:
{quote}
I/TiAPI ( 1963): 0 : hello
I/TiAPI ( 1963): 1 : 縺薙s縺ォ縺。繧�
{quote}
Created PR #2616 to resolve issue. https://github.com/appcelerator/titanium_mobile/pull/2616
https://github.com/appcelerator/titanium_mobile/pull/2616 was merged.