{ "id": "64203", "key": "TIMOB-3571", "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": [], "resolution": { "id": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-09T19:01:50.000+0000", "created": "2011-04-15T03:46:46.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [ { "id": "14397", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "81852", "key": "TIMOB-6922", "fields": { "summary": "Android: Network - HTTPClient cannot retrieve non-ascii data", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-09T19:01:50.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Problem\r\n\r\nWhen my app received a UTF-8 text form HTTP Server, the encoding of responseText of Titanium.Network.HTTPClient can be seen invalid.\r\nAn ASCII text is OK and for iPhone is OK, but for Android, I cannot guess in which encoding method is the received test.\r\n\r\nh2. Workaround\r\n\r\nWe avoid this problem as like below:\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar httpc = Ti.Network.createHTTPClient();\r\n\r\nhttpc.onload = function() {\r\nvar canvases = [];\r\nvar lines = \"\";\r\nif (Ti.Platform.osname == 'iphone') {\r\n lines = this.responseText.split(\"\\n\");\r\n} else if (Ti.Platform.osname == 'android') {\r\n lines = (\"\" + this.responseData).split(\"\\n\");\r\n}\r\n{code}\r\n\r\nThen, my app can get the desired string in variable 'lines'.", "attachment": [], "flagged": false, "summary": "Android: Network - responseText of createHTTPClient invalid for UTF8 encoding", "creator": { "name": "sakira", "key": "sakira", "displayName": "sakira", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "sakira", "key": "sakira", "displayName": "sakira", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "176955", "author": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "body": "As indicated by the reporter in the original title, this ticket relates to android. Hence, correcting Component field.\r\n\r\n", "updateAuthor": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "created": "2011-12-21T15:58:48.000+0000", "updated": "2011-12-21T15:58:48.000+0000" }, { "id": "338154", "author": { "name": "leoleal", "key": "leoleal", "displayName": "Leonardo Leal", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "Explicitly declare the charset on your service's response header, and It will be fixed. I had this very same problem, and It seems that when you don't declare the response charset on the \"content-type\" header, Android tries to use the current locale of the OS for response texts, which changes from user to user around the world.\r\n\r\nSet your response header to something like \"Content-Type: application/json;charset=utf-8\" and your problem will be solved.", "updateAuthor": { "name": "leoleal", "key": "leoleal", "displayName": "Leonardo Leal", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2015-01-07T12:56:45.000+0000", "updated": "2015-01-07T12:56:45.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }