Techblog

Tech Blog

Our latest geek adventures!

25 March Encoding UTF-8 in Javascript

Posted by Gert-Jan on in Javascript

I had to make a call from Javascript to a SOAP web service (more on that later). The data I had to send to the web service was in a XML format that contained non ASCII characters (for example: é). I tried to use the standard escape() function, but that one couldn’t handle the special characters.

Thanks to ecmanaut I found a very simple solution: encodeURIComponent() (with decodeURIComponent() as its counterpart).

Leave a Reply