Guest User

Untitled

a guest
Dec 30th, 2011
33
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String.prototype.leftPad = function (l, c) { return new Array(l - this.length + 1).join(c || '0') + this; }
  2.  
  3. function utf8ToUnicode(s){var r = []; for(var i=0, len=s.length; i<len; i++) r.push("\\u"+s.charCodeAt(i).toString(16).leftPad(4)); return r.join(''); }
  4.  
  5. console.log(utf8ToUnicode('سلام'));
RAW Paste Data