title: Converting ArrayBuffer to String then back to ArrayBuffer using TextDecoder/TextEncoder returning a different result
body: <p>I have an ArrayBuffer which is returned by reading memory using Frida. I'm converting the ArrayBuffer to a string, then back to an ArrayBuffer using TextDecoder and TextEncoder, however the result is being altered in the process. The ArrayBuffer length after decoding and re-encoding always comes out larger. Is there a character decoding in an expansive fashion?</p>
  
  <p>How can I decode an ArrayBuffer to a String, then back to an ArrayBuffer without losing integrity?</p>
  
  <p>Example code:</p>
  
  <pre><code>var arrayBuff = Memory.readByteArray(pointer,2000); //Get a 2,000 byte ArrayBuffer
  
  console.log(arrayBuff.byteLength); //Always returns 2,000
  
  var textDecoder = new TextDecoder("utf-8");
  var textEncoder = new TextEncoder("utf-8");
  
  //Decode and encode same data without making any changes
  var decoded = textDecoder.decode(arrayBuff);
  var encoded = textEncoder.encode(decoded);
  
  console.log(encoded.byteLength); //Fluctuates between but always greater than 2,000
  </code></pre>