code: function utf8Encode(str) {
    var bytes = [], offset = 0, length, char;
  
    str = encodeURI(str);
    length = str.length;
  
    while (offset < length) {
      char = str.charAt(offset);
      offset += 1;
  
      if (char !== '%') {
        bytes.push(char.charCodeAt(0));
      } else {
        char = str.charAt(offset) + str.charAt(offset + 1);
        bytes.push(parseInt(char, 16));
        offset += 2;
      }
    }
  
    return bytes;
  }
docs: internal helpers //////////////////////////////////////////////////////////