Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8369] iOS: Titanium.Network.HTTPClient cannot parse Windows-1255 encoded pages

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.0.1, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterGilad Novik
AssigneeUnknown
Created2012-03-16T19:12:53.000+0000
Updated2018-03-06T18:57:54.000+0000

Description

Problem Description

When using HTTPClient to fetch Hebrew pages, the resulting string is null.

Actual Results

Result is null, even if you got something from the webservice.

Expected results

Working fine.

Test Case

var win = Ti.UI.createWindow();
var client = Ti.Network.createHTTPClient({
	onload : function(e) {
	Ti.API.info(this.responseText); // this will always output 'null'
	}
});
client.open("GET", 'http://rotter.net/cgi-bin/listforumf.pl');
client.send();
win.open();

Comments

  1. Gilad Novik 2012-03-16

    Objective-C code will try to guess the right encoding, but windows-1255 is not available in the list. titanium_mobile / iphone / Classes / TiNetworkHTTPClientProxy.m:
       		TRYENCODING("windows-1252",12,NSWindowsCP1252StringEncoding);
       		TRYENCODING("iso-8859-1",10,NSISOLatin1StringEncoding);
       		TRYENCODING("utf-8",5,NSUTF8StringEncoding);
       		TRYENCODING("shift-jis",9,NSShiftJISStringEncoding);
       		TRYENCODING("shift_jis",9,NSShiftJISStringEncoding);
       		TRYENCODING("x-euc",5,NSJapaneseEUCStringEncoding);
       		TRYENCODING("euc-jp",6,NSJapaneseEUCStringEncoding);
       		TRYENCODING("windows-1250",12,NSWindowsCP1251StringEncoding);
       		TRYENCODING("windows-1251",12,NSWindowsCP1252StringEncoding);
       		TRYENCODING("windows-1253",12,NSWindowsCP1253StringEncoding);
       		TRYENCODING("windows-1254",12,NSWindowsCP1254StringEncoding);
       
    The following line will add Windows-1255 support:
       		TRYENCODING("windows-1255",12,CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingWindowsHebrew));
       
  2. Gilad Novik 2012-03-20

    Apparently Android has a similar bug. responseText does have a value - but it was using the wrong encoding to convert, resulting in a useless string.
  3. Junaid Younus 2012-05-21

    Tested with 2.0.1GA2 on the iOS simulator, issue still exists.
  4. jithinpv 2013-04-17

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0

JSON Source