[AC-4640] openURL UTF8 GET parameters problem
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2016-12-01T14:34:04.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | ios |
Reporter | Morten Hopstad |
Assignee | Shak Hossain |
Created | 2016-11-24T09:37:27.000+0000 |
Updated | 2016-12-01T14:34:04.000+0000 |
Description
Hello.
On Android build made on Windows computer this is working fine.
On my MAC computer making the iOS build however I can not get this to work.
I open an URL like this :
var test = 'æøå';
var test2 = 'MoreÆØÅ';
var url = 'https://somesite.com/?getParam1=' +test+ '&getParam2=' + test2;
openURL(url);
---
Result is a messed up string . I have also tried using Ti.Network.encodeURIComponent('øæå');
with the same result.
Hello, What Titanium SDK are you using? Can you send a full sample code? Use the latest studio and SDK version. Thanks.
Hello. I'm using the latest version of everything. (SDK is V6.0.0.GA) My code is used for opening a direct chat into a company and includes some semi-private keys etc. Therfor it will be difficult for me to show this exact code online for the public to see. Im doing the same thing on both the Android version and the iOS version. As mentioned, the Android version built on the Windows computer works fine but the iOS built on MAC shows the following:
Two things here: - The
Ti.Network.encodeURIComponent
works correctly, it encodes it utf-8 conform - You should try to avoid (un-encoded) special characters in requests, and if you do, your server would need to know how to deal with the encoded URI-string. This does not like an Titanium issue to me. Please try [this link](http://httpbin.org/get?param=More%C3%86%C3%98%C3%85) which will encode it the same way as the method does. We can test it with a native project as well, but it will most likely be the same.Hello and thank you for respons. My first thought was also that this was how the server is handling these encoded strings. But then I can see it's working in 2 of 3 cases. That was what made question Titanium and made a ticket. Android Build : Works fine. The string is decoded on the server and shows properly. Website (Javascript) : Works fine. Using URI-encoding (encodeURI()) iOS : Trouble. Cant be decoded.
Hello, I tried testing in simulator with your sample code. I wasn't able to reproduce the issue in iOS, The URL is same as it should be.
See my [screenshot](http://i64.tinypic.com/11vlely.jpg) of the browser trying to open the url in iOS simulator.