code: function stringToByteArray(str) {
  	const byteArray = [];
  	for (let i = 0; i < str.length; i++) {
  		if (str.charCodeAt(i) <= 0x7F) {
  			byteArray.push(str.charCodeAt(i));
  		} else {
  			const h = encodeURIComponent(str.charAt(i)).substr(1).split('%');
  			for (let j = 0; j < h.length; j++) {
  				byteArray.push(parseInt(h[j], 16));
  			}
  		}
  	}
  
  	return byteArray;
  }
docs: Converts the input UTF-8 string to a byte array. From http://stackoverflow.com/questions/1240408/reading-bytes-from-a-javascript-string?lq=1