Problem
When loading some JSON file (UFT-8) from the web and displaying the data, the Non-Ascii-chars text is garbled.
See attached screenshot of this problem on 1.7.2
Note that this works fine on iPhone.
The Kitchen Sink Demo of XHR has the same problem. It works on the iPhone but fails on Android.
Test case
Ti.UI.setBackgroundColor('#ddd');
var win = Ti.UI.createWindow({});
var loadDataButton = Ti.UI.createButton({
title: "Let's load UTF-8 from the web!", width: 260, top: 50, height: 40
});
win.add(loadDataButton);
loadDataButton.addEventListener('click', function() {
var test1 = loadFromWeb("http://crossplattformvergleich.dnsalias.org/test.js"); /* file contains in UTF8: { "result" : "áäüÖßÉ?" } and a comment */
var test2 = loadFromWeb("http://crossplattformvergleich.dnsalias.org/test2.js"); /* this is a 36-byte file. Appears as 0 bytes on android */
});
function loadFromWeb(url) {
var asyncRequest = Ti.Network.createHTTPClient();
asyncRequest.timeout = 30*1000;
asyncRequest.open("GET", url);
asyncRequest.onload = loadCallback;
asyncRequest.send();
}
function loadCallback() {
alert(this.responseText);
}
win.open();
Discussions
Q&A: [problem fetching uft-8 content on android](
http://developer.appcelerator.com/question/126712/problem-fetching-uft-8-content-on-android#comment-101538)
Thanks for raising this ticket, Felix. Please note the changes I have made, that were necessary before I could escalate it. Keeping to the [How to Submit a Bug Report](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report) guide means that your tickets can be escalated more quickly. Hence, all information must be included in the ticket, rather than rely on external sources. Regarding the following, note that a ticket may only describe a single bug. If you have found a second bug, please raise another ticket.
I will move this to the main project now. Cheers
Tested with 2.0.2.v20120505151714 with Samsung Nexus S 4.0.4