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

144
Views
How to encode html code or url to this format \u00253Cbr\....?

How to encode html code or url to this format?:

\u00253Cb\u002522\.... 

THANK YOU!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To convert URL to this you need to convert your URL (string) to unicode format

you can try following function for it.


// here toUnicode function is attached to string so that it can used further with 
//other strings also

String.prototype.toUnicode = function(){
    var result = "";
    for(var i = 0; i < this.length; i++){
        // Assumption: all characters are < 0xffff
        result += "\\u" + ("000" + this[i].charCodeAt(0).toString(16)).substr(-4);
    }
    return result;
};

let name = "john";

name.toUnicode(); // this will return unicodes of strings

And on another side you can get the Unicode URL using window.location.href (which will be in unicode) you can convert back into string using following function.

// this function coverts the unicode to string char by char 
// so you need to loop through the string and call this function a
//nd create resultant string

function unicodeToChar(text) {
   return text.replace(/\\u[\dA-F]{4}/gi, 
          function (match) {
               return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
          });
}
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!