Friday, September 28, 2012

Jquery UTF8 Encode and Decode

To encode and decode using UTF8

UTF8 will encode only UTF8 characters not like base64.

No need to Include any JS file in your project, just add jquery file

Encode:

function encode_utf8(s) { 

 return unescape(encodeURIComponent(s)); 


Decode:

  function decode_utf8(s) { 

     return decodeURIComponent(escape(s)); 

 }



Ex:  alert(encode_utf8("Text�‡‰™©"))

7 comments: