[AC-6003] Android/iOS : decodeURIComponent() method not working
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2018-12-10T11:29:56.000+0000 |
Affected Version/s | Appcelerator Studio 4.4.2 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | andoid, decode, ios |
Reporter | Jignesh Kasundra |
Assignee | Shak Hossain |
Created | 2018-11-01T09:40:47.000+0000 |
Updated | 2018-12-10T11:29:56.000+0000 |
Description
I'm trying to display equivalent text for the below string but it's not working
var win = Ti.UI.createWindow({
backgroundColor : 'white'
});
win.open();
alert(decodeURIComponent('Hello – World'));
the resulted text should be >> Hello – World
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:decodeURIComponent('Hello%20%E2%80%93%20World')
Try to run the "normal" text throughencodeURIComponent
to see the correct URI text. And if you are using Alloy/underscore you can use https://underscorejs.org/#unescape to unescape the HTML entitiesHi Michael i have tryed to encode the character in Titanium using encodeURIComponent('Hello – World') method and got the below result Hello%20%26%238211%20World and got the correct result on browser by decodeURIComponent() method but while using in Titanium it's returning the back to same character *Hello – World* how to i implement this with titanium ? i am using titanium classic project in my app i am getting *Hello – World* as original string thanks.
Again, you are using it wrong:
outputs the correct result in Ti 7.4.1 (Android)
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 itso my problem is i am getting *Hello – World* as original string and in the titanium label control have to print Hello – World is there anyway to implement this ?
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. There are even modules you'll find on google: https://github.com/appcelerator-forks/kosso.TiHTML or something like this
Hello [~jignesh.igp], Just passing as update here.Are you able to get that sorted out? Please let us know if you need help with this issue. Thanks
Hello, I just wanted to follow up with you about this issue? Are you still experiencing this problem? Please let us know if you need more help with this issue. Thanks
Hello, my issue is resolved. please close the issue Thanks