question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Router query chops away chars

See original GitHub issue

Bug report

Describe the bug

When passing some variables as query parameter, some chars get removed in router.query values. Feks phonenumbers: +47111111111, then when getting the query.contact, the pluss is gone. Is there a way for me to tap into this to get the pluss added?

I tried encoding before sending in, but + is not misunderstood. I see the right value, with the +, in the asPath variable

To Reproduce

const Index = () => {
  const router = useRouter()
  const { contact } = router.query
  const hasThePlussSign = router.asPath;
  return (
    <div>
      {contact}
    </div>

  )
}

Expected behavior

Get the + sign included in the query value

System information

  • OS: macOS
  • Browser (if applies): chrome
  • Version of Next.js: 9.1.4

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
timneutkenscommented, Jan 21, 2020

Please try next@canary

0reactions
balazsorban44commented, Jan 30, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Router query chops away chars · Issue #10185
Bug report Describe the bug When passing some variables as query parameter, some chars get removed in router.query values.
Read more >
JavaScript preserve query format using Next.js Router
How do I chop/slice/trim off last character in string using Javascript? 2261 · Get selected value in dropdown list using JavaScript · 1927....
Read more >
Working with Query Strings in Blazor
In this post, I talk about query strings in Blazor. We start by understanding what they are and why we'd chose to use...
Read more >
Ruby On Rails Tutorial: Controller and Parameters - 2020
The first are parameters that are sent as part of the URL, called query string parameters. The query string is everything after "?"...
Read more >
addslashes - Manual - PHP
A use case of addslashes() is escaping the aforementioned characters in a ... is not the only special character that can break your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found