1 Reply Latest reply on Jan 29, 2011 7:13 PM by arvid terzibaschian

    HTTPService returns non-unicode encoding

    arvid terzibaschian

      Hi there!


      Using HTTPService I am loading a page which is encoded in http://en.wikipedia.org/wiki/Windows-1251 charset.

      The result type of my service request is "text".


      The problem is, that air does not convert the characters in the request's result string into their valid Unicode counterparts (e.g. charCodeAt stays  <= 255) and thus prints them invalid onscreen.


      Is there a way to convert or tell air to expected a certain codepage for a HTTPService's result?


      Thanks in advance

        • 1. Re: HTTPService returns non-unicode encoding
          arvid terzibaschian Level 1

          Ow, already found the answer

                      // convert s : String in  windows-1251 format to unicode (sUnicode)
                      var ba:ByteArray = new ByteArray();
                      for(var i : int = 0;i<s.length;++i)
                      ba.position = 0;
                      var sUnicode : String = ba.readMultiByte(ba.length, "windows-1251");