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

+ is parsed as white space #119

Closed
caddac opened this issue Jan 9, 2018 · 6 comments · Fixed by #214
Closed

+ is parsed as white space #119

caddac opened this issue Jan 9, 2018 · 6 comments · Fixed by #214

Comments

@caddac
Copy link

caddac commented Jan 9, 2018

I see there is a test that indicated + should be parsed into white space, however when I test this here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
+ is encoded as %2B.

@sindresorhus
Copy link
Owner

@caddac
Copy link
Author

caddac commented Jan 24, 2018

Resolved by using encodeUriComponent to convert + into %2B in query strings.

@visualcookie
Copy link

Hey @caddac

This did not work in my case. When doing

const urlEncode = encodeURIComponent(location.search)
const urlParsed = query.parse(urlEncode)

it returns
image

@lebed2045
Copy link

lebed2045 commented Aug 28, 2019

doesn't work for my either

@Anusien
Copy link
Contributor

Anusien commented Sep 20, 2019

Why does query-string.parse() still convert '+' into ' ' when the decode option is set to false? This isn't handled by decode-uri-component but it's manually done via string manipulation.

@RenderCoder
Copy link

Why does query-string.parse() still convert '+' into ' ' when the decode option is set to false? This isn't handled by decode-uri-component but it's manually done via string manipulation.

In my use case, URL has a Base64 query string value, it will be wrong if the + convert to space automatically. Maybe I need to replace back to + for my Base64 query string.

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

Successfully merging a pull request may close this issue.

6 participants