-
Notifications
You must be signed in to change notification settings - Fork 43
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
Should "+" in query parameters be parsed as space? #32
Comments
In the query part, it exactly means a space: |
work around elm/url#32. #4313 Signed-off-by: Jamie Klassen <[email protected]>
That refers to forms, not to URLs. URL standard - parsing does not mention that And if you look at URL equivalence, it's clear that So this issue should be closed. |
Standard or no standard, if you create a vanilla HTML form and use it to submit some text (via GET) with a space in it, then you'll get the a |
When submitting a form with built-in But that is just one way to use query strings and not the only way. Query strings can also be used for other things which have nothing to do with submitting forms - and in those cases URL standard says that space is not equivalent to Also forms can be submitted without using |
COMPLETELY WRONG. There isn't a single browser which encodes space as plus in query string when not submitting a form. Also standard does not allow that but specifically forbids that when not submitting a form. |
How is it problematic or breaking? toForm : String -> String
toForm query = String.replace "+" " " query |
Note that this should be done before Url.Parser.parse { url | query = Maybe.map (String.replace "+" "%20") url.query } |
Nonetheless, this does not seem to be an issue with |
@EvenAR is this still an issue? |
I think this issue can be closed. If this way of encoding spaces is specific to Html forms and not part of standard URL encoding, I agree this is not an issue with elm/url. It's not too hard to handle it explicitly when needed. |
This issue should be reopened. The browser is not the only software that implements the URL spec rather than the raw URI RFC. In my case, the URLs that point to my Elm app are generated by a Java web server with the I also cannot correctly workaround this on the Elm side since:
|
Our front page has a standard html search form. If the user types a search string, eg.
"hello world"
and submit the form, the user is taken to/search?query=hello+world
where the elm application is located. When parsing the query parameter I expect the output to be"hello world"
- however the actual output is"hello+world"
. Is this intentional or is this something that should be fixed? I haven't found specific documentation on this, but it seems to be common practice to handle+
in query paramaters as space.Example (21 Mar 2021):
The text was updated successfully, but these errors were encountered: