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

236
Views
Unescape Unicode char in javascript

I am expecting to get a string containing non ascii chars, for eg. the string Øvo, but the string I get instead contains a different representation of that char: Ã\u0098vo. How can I convert this to the string I want?

I know how this string represention is obtained but I can't undo that encoding:

let modelString = JSON.stringify(model);
return window.btoa(unescape(encodeURIComponent(modelString))); 

I have been trying a lot of functions (from Firefox console) but I'm not getting the expected result:

  • window.atob(escape(decodeURIComponent('Ã\u0098vo'))) -> Uncaught DOMException: String contains an invalid character
  • escape(decodeURIComponent('Ã\u0098vo')) -> "%C3%98vo"
  • JSON.parse('["Ã\u0098vo"]')[0] -> "Ã\u0098vo"
  • JSON.parse('["Ã\u0098vo"]')[0] -> "Ã\u0098vo"
  • unescape('Ã\u0098vo') -> "Ã\u0098vo"
  • unescape('Ã\u0098vo') -> "Ã\u0098vo"
  • String.fromCharCode(parseInt('98',64)) -> "\u0000"
  • String.fromCharCode(parseInt('98')) -> "b"
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Avoid using unescape as it is "removed from the Web standards"!

var model = {"key": "Øvo"};
var modelString = JSON.stringify(model);
var uriEncoded = encodeURIComponent(modelString);

console.log(uriEncoded);
// wrong
console.log(unescape(uriEncoded));
// right
console.log(decodeURIComponent(uriEncoded));

// btoa convertion
var b2a = btoa(decodeURIComponent(uriEncoded));
console.log(b2a);
// the reverse conversion
var a2b = atob(b2a);
console.log(a2b);

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