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

216
Views
JavaScript function urlDecode() returns error when string includes "%%20"

I found a great function urlDecode() here - https://stackoverflow.com/a/4458580/8950583

After years of usage I have a problem with this function now.

I have text string:

{{form.Rate_%%20|%20url_encode}}

It should return:

{{form.Rate_% | url_encode}}

But it returns error like "malformed URI" because of that seqeunce "%%20"

I made a quick fix by adding .replace(/%%/g, '%25%') to the function - so now it is:

function urlDecode(str) {
    return decodeURIComponent((str+'').replace(/%%/g, '%25%').replace(/\+/g, '%20'));
}

But I am not sure if it will not cause problems in any circumstances.

Please do you thing it is safe? Or how would you handle it?

about 4 years ago · Juan Pablo Isaza
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!