Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent encoding/decoding in different url segments #61

Open
Olg-K opened this issue May 24, 2016 · 0 comments
Open

Inconsistent encoding/decoding in different url segments #61

Olg-K opened this issue May 24, 2016 · 0 comments

Comments

@Olg-K
Copy link

Olg-K commented May 24, 2016

Hello Derek,

Thank you for the great library!

It seems like Uri object only decodes query parameter values and keeps the rest of the segments "as is". Which leads to what seems to be inconsistent output for the most of its methods, especially .toString() and .query(). Please see the example below.

var encodedStr = encodeURI('http://ářé.html?ářé=ářé#ářé');

var url = new Uri(encodedStr);

url.host(); // encoded string;
url.getQueryParamValue('ářé');   // decoded string
url.queryPairs; // both query parameter name and value are decoded
url.query();    // mixed encoded and decoded characters
url.anchor();   // encoded string
url.toString(); // mixed encoded and decoded characters

It would be much easier for client code to consume the output of those methods if they always yield fully encoded or decoded strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant