leodutra
8/27/2014 - 8:01 PM

Fully Encode URI/URL

Fully Encode URI/URL

function fullEncodeURI(str) {
  if (str !== undefined && str !== null) {
    str = '' + str;
    var res = '';
    for(var i = 0, l = str.length; i < l ;) {
      res += '%';
      res += str.charCodeAt(i++).toString('16');
    }
    return res;
  }
}