-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Make URI.encode/1
to conform to RFC 3986. Introduce URI.encode/2
function.
#2392
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
Conversation
Thanks @lexmag! Just to be sure we are moving in the right direction, how other languages handles this? Is space always escaped as |
I've checked Ruby, NodeJS, Haskell, C# - all do |
Thanks. I see that reserved and unreserved do not take all possible characters (they are mutually exclusive). What happens when a characters is not in any of those groups? |
Haskell applies transformation depending of "predicate" function (like 448947abbc90d70c5ab76251133e8c6ec72ccd6c). |
Most common character transformations are:
|
@josevalim character will be percent-encoded. |
Yeah, I would go something similar. I don't think our |
Does For instance, where can I find an example of the query string like in this test? http://en.wikipedia.org/wiki/Percent-encoding#The_application.2Fx-www-form-urlencoded_type |
Here are question came to mind:
I'd go with:
@josevalim @alco WDYT? |
@alco Ruby has |
@lexmag I agree with the answer to all questions. One other question is if we want to provide |
`URI.encode/1` escapes character if it is not satisfied `URI.char_unescaped?/1`
Updated. |
I've checked Twitter API. |
c in ?0..?9 or | ||
c in ?a..?z or | ||
c in ?A..?Z or | ||
c in '~_-.' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's crying 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😁 it's intentional
Make `URI.encode/1` to conform to RFC 3986. Introduce `URI.encode/2` function.
Thank you @lexmag! @alco and @lexmag what do you think about adding https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/uri.ex#L145 Must now be Also, should we change |
I think we need functionary to handle |
And we need a pair for it :) |
Our |
Sure. |
Can we call it |
I would keep it |
%20
, not+
(it is behaviour of very early version of the URI percent-encoding rules).URI.encode/2