Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

529
Views
React routes param auto decode string

Hi does react router params automatically decodes string?

For example i have this route

<Route path="/callback/:url"/>

and when I call it with C5jb20%3D

it will print C5jb20= when I console.log() that parameters

Is this an expected behavior? Can I change this behavior so that I still get the encoded string?

Thanks!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

C5jb20%3D is a URL encoded string, which is a way to encode special characters in a URL. For example, if you have a URL parameter like ?redirect=/some/path, a server could interpret the forward slashes as routing paths, and mess up the expected routing. That's why you see things like ?redirect=%2Fsome%2Fpath, and your example, in URLs.

window.location.path will have the original, unencoded URL.

You could also get it back with encodeURIComponent:

encodeURIComponent('C5jb20=') // "C5jb20%3D"

You probably don't want to, though, depending on your use case.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!