{ "id": "81959", "key": "TIMOB-6835", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12096", "description": "", "name": "Sprint 2012-04", "archived": true, "released": true, "releaseDate": "2012-02-26" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-02-21T16:44:36.000+0000", "created": "2011-10-26T05:13:09.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_network", "parity", "qe-testadded" ], "versions": [ { "id": "11971", "description": "iOS5 and select Android fixes", "name": "Release 1.7.3", "archived": true, "released": true, "releaseDate": "2011-10-18" } ], "issuelinks": [], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-06-19T12:43:15.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h2. Problem\r\n\r\nMost of Japanese webpages use utf-8 encoding, but some pages use old encodings (Shift-JIS or EUC-JP).\r\n\r\ncharset list (as reference)\r\nhttp://www.iana.org/assignments/character-sets\r\n\r\nBut a return value will be set to null if Japanese webpage is acquired using Titanium.Network.createHttpClient. \r\n \r\nh2. Test case\r\n\r\nI make a sample code which accesses each charset sample webpage and display their results.\r\n\r\n{code:javascript|title=app.js}\r\nvar win1 = Ti.UI.createWindow({\r\n\tbackgroundColor: 'white',\r\n});\r\nvar text = Ti.UI.createLabel({\r\n\ttext: '',\r\n});\r\nwin1.add(text);\r\nwin1.open();\r\ncharsetTest(\"http://kangaechu.com/utf8.html\");\r\ncharsetTest(\"http://kangaechu.com/shiftjis.html\");\r\ncharsetTest(\"http://kangaechu.com/eucjp.html\");\r\n\r\nfunction charsetTest(url){\r\n\tvar xhr = Ti.Network.createHTTPClient();\r\n\t\r\n\txhr.onload = function() {\r\n\t\tif(this.status == 200) {\r\n\t\t\tvar html = this.responseText;\r\n\t\t\tif(html == null){\r\n\t\t\t\ttext.text = text.text + url + ' is null.\\n\\n';\r\n\t\t\t}\r\n\t\t\telse if(html.match(/([\\s\\S]*)<\\/body>/)){\r\n\t\t\t\tvar body = RegExp.$1;\r\n\t\t\t\ttext.text = text.text + url + body;\r\n\t\t\t}else{\r\n\t\t\t\ttext.text = text.text + url + ' is 200, but no body element.\\n\\n';\r\n\t\t\t}\r\n\t\t}else{\r\n\t\t\ttext.text = text.text + url + ' status code is ' + this.status + '\\n\\n';\r\n\t\t}\r\n\t};\r\n\txhr.onerror = function() {\r\n\t\ttext.text = text.text + url + ' status code is ' + this.status + '\\n\\n';\r\n\r\n\t};\r\n\txhr.open(\"GET\", url, false);\r\n\txhr.send();\r\n\t\r\n}\r\n{code}\r\n\r\nresult is below:\r\n||OS || UTF-8 || Shift_JIS || EUC-JP ||\r\n|iOS | OK | null | null|\r\n\r\nh2. Suggested Fix\r\n\r\nTo fix this bug, add charset list to TiNetworkHTTPClientProxy.m\r\n\r\nSee https://github.com/appcelerator/titanium_mobile/pull/590", "attachment": [], "flagged": false, "summary": "iOS: Network - createHttpClient cannot handle Japanese Shift_JIS and EUC-JP encoding", "creator": { "name": "kangae2", "key": "kangae2", "displayName": "Satoshi Tanaka", "active": true, "timeZone": "Asia/Tokyo" }, "subtasks": [], "reporter": { "name": "kangae2", "key": "kangae2", "displayName": "Satoshi Tanaka", "active": true, "timeZone": "Asia/Tokyo" }, "environment": "* Titanium SDK version: 1.7.3\r\n* iPhone SDK version: 4.3 Found 4.3.2 patch installed\r\n* Device Details: iOS simulator\r\n* Host Operating System: OSX 10.7.2\r\n* Titanium Studio version: 1.0.4.201108101535\r\n* Xcode 4.1 Build version 4B110\r\n", "comment": { "comments": [ { "id": "186552", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing bug. Verified fix on:\r\n\r\nSDK build: 2.0.0.v20120314154741\r\nTitanium Studio, build: 2.0.0.201203132050\r\nxcode: 4.2\r\nDevice: iphone 4s (5.0.1)", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-03-14T16:59:31.000+0000", "updated": "2012-03-14T16:59:31.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }