function string2byteString(str) {
  if (!/[\u0080-\uFFFF]/.test(str)) return str;
  if (!encoder) encoder = new TextEncoder();
  return buffer2string(encoder.encode(str));
}
Returns a UTF8-encoded binary string i.e. one byte per character.
Returns the original string in case it was already within ASCII.