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

Route parameter value with an encoded '?' as %3F not decoded in params #5607

Closed
kellyrmilligan opened this issue Oct 10, 2017 · 2 comments
Closed

Comments

@kellyrmilligan
Copy link
Contributor

Version

4.1.1

Test Case

https://codesandbox.io/s/zqj6wvk7m3

Steps to reproduce

click on the Topic Example ?

Expected Behavior

topic example %3F should be displayed as topic example ?

Actual Behavior

the param is displayed as topic example %3F

@timdorr
Copy link
Member

timdorr commented Oct 10, 2017

This is ultimately caused by history. Here's the issue open to track the bug: remix-run/history#505

@pshrmn
Copy link
Contributor

pshrmn commented Jan 22, 2018

As a follow up, history uses decodeURI to decode pathnames. decodeURI cannot decode escape sequences that could not have been created by encodeURI. This means that because encodeURI cannot encode a question mark, decodeURI cannot decode an encoded question mark.

const eU = encodeURI('?') // '?'
const eUC = encodeURIComponent('?') // '%3F'
decodeURI(eU) // '?'
decodeURI(eUC) // '%3F'

I would say that if you have characters that need to be encoded using encodeURIComponent, you should expect to have to call decodeURIComponent to decode them.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants