{ "id": "172535", "key": "AC-6003", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "11", "description": "Is not a bug in our product", "name": "Not Our Bug" }, "resolutiondate": "2018-12-10T11:29:56.000+0000", "created": "2018-11-01T09:40:47.000+0000", "labels": [ "andoid", "decode", "ios" ], "versions": [ { "id": "17037", "name": "Appcelerator Studio 4.4.2", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2018-12-10T11:29:56.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm trying to display equivalent text for the below string but it's not working\r\n\r\n\r\n{code:java}\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'white'\r\n});\r\n\r\nwin.open();\r\n\r\nalert(decodeURIComponent('Hello – World'));\r\n\r\n{code}\r\n\r\n\r\nthe resulted text should be >> Hello – World\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android/iOS : decodeURIComponent() method not working", "creator": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Operating System\r\n Name = Mac OS X\r\n Version = 10.13.4\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 8.9.4\r\n npm Version = 5.6.0\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 7.4.1.GA\r\n Target Platform = iphone", "comment": { "comments": [ { "id": "443178", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "That doesn't work in Javascript. Run the {{alert(decodeURIComponent('Hello – World'));}} in the Firefox developer tools and you will see the same text. The proper encoded version would be:\r\n\r\n{{decodeURIComponent('Hello%20%E2%80%93%20World')}}\r\n\r\nTry to run the \"normal\" text through {{encodeURIComponent}} to see the correct URI text. \r\n\r\nAnd if you are using Alloy/underscore you can use https://underscorejs.org/#unescape to unescape the HTML entities", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-01T11:48:47.000+0000", "updated": "2018-11-01T11:51:27.000+0000" }, { "id": "443180", "author": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Michael\r\n\r\ni have tryed to encode the character in Titanium using encodeURIComponent('Hello – World') method\r\n\r\nand got the below result\r\n\r\nHello%20%26%238211%20World\r\n\r\nand got the correct result on browser by decodeURIComponent() method\r\n\r\nbut while using in Titanium it's returning the back to same character *Hello – World*\r\n\r\nhow to i implement this with titanium ?\r\n\r\n i am using titanium classic project\r\n\r\nin my app i am getting *Hello – World* as original string\r\n\r\nthanks.", "updateAuthor": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-01T12:14:25.000+0000", "updated": "2018-11-01T12:25:17.000+0000" }, { "id": "443181", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Again, you are using it wrong:\r\n{code}\r\nvar enc = encodeURIComponent(\"Hello – World\");\r\nvar dec = decodeURIComponent(enc);\r\nconsole.log(enc);\r\nconsole.log(dec);\r\n{code}\r\n\r\noutputs the correct result in Ti 7.4.1 (Android)\r\n\r\n{{Hello – World}} is not an URLComponent text. It is a HTML entities text. And you would need to use either a Webview or underscore (or something else from https://stackoverflow.com/questions/5796718/html-entity-decode) to decode it", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-01T12:21:12.000+0000", "updated": "2018-11-01T12:25:41.000+0000" }, { "id": "443182", "author": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "body": "so my problem is i am getting *Hello – World* as original string and in the titanium label control have to print Hello – World\r\n\r\nis there anyway to implement this ?", "updateAuthor": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-01T12:27:38.000+0000", "updated": "2018-11-01T12:39:12.000+0000" }, { "id": "443183", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "Either change your API that it will send proper strings or search for decoding HTML entities -> text in Javascript (e.g. https://stackoverflow.com/questions/17678694/replace-html-entities-e-g-8217-with-character-equivalents-when-parsing-an). So this is not a bug and better be asked in TiSlack or Stackoverflow.\r\nThere are even modules you'll find on google: https://github.com/appcelerator-forks/kosso.TiHTML\r\n\r\nor something like this\r\n\r\n{code}\r\nvar decodeHtmlEntity = function(str) {\r\n return str.replace(/&#(\\d+);/g, function(match, dec) {\r\n return String.fromCharCode(dec);\r\n });\r\n};\r\ndecodeHtmlEntity(\"Hello – World\")\r\n{code}", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-11-01T12:39:47.000+0000", "updated": "2018-11-01T12:45:47.000+0000" }, { "id": "444118", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~jignesh.igp],\r\nJust passing as update here.Are you able to get that sorted out? Please let us know if you need help with this issue.\r\n\r\nThanks", "updateAuthor": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2018-12-01T17:57:32.000+0000", "updated": "2018-12-01T17:57:32.000+0000" }, { "id": "444399", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nI just wanted to follow up with you about this issue? Are you still experiencing this problem?\r\nPlease let us know if you need more help with this issue.\r\n\r\nThanks", "updateAuthor": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-12-10T10:33:58.000+0000", "updated": "2018-12-10T10:33:58.000+0000" }, { "id": "444405", "author": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nmy issue is resolved. please close the issue\r\n\r\nThanks", "updateAuthor": { "name": "jignesh.igp", "key": "jignesh.igp", "displayName": "Jignesh Kasundra", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-12-10T11:23:40.000+0000", "updated": "2018-12-10T11:23:40.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }