Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-6922

Android: Network - HTTPClient cannot retrieve non-ascii data

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: Release 1.7.5, Release 1.8.0.1
    • Component/s: Android
    • Environment:
    • Story Points:
      2

      Description

      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

      app.js

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pwang Ping Wang
                Reporter:
                fex80 Felix Alcala
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-11554
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code