Convert a UTF-8 String to an ArrayBuffer With Hex

Hello, I don’t seem to understand how to convert the following string to the following hex string then to an ArrayBuffer.


If anyone could shed some light on the topic, I would greatly appreciate it.
Note: I tried this and this is the product I got v

Hello, @edwrddd! This should be pretty straightforward as you just create a Buffer object with your UTF-8 string and use Uint8Array to convert it to an ArrayBuffer.

Here’s some code to help you:

var words = "put your string here";

var theArrayBuffer = new Uint8Array(Buffer.from(words, "utf-8")).buffer;

Thanks, but I’d like to use this on client-sided JavaScript. Buffer isn’t supported frontend.

See this package for using Buffer on the browser:

Thanks, but that still isn’t seeming to do the trick. The first eight characters are returning as 2e2e 642e 2e2e 2e2e and they need to be 001e 6416 0501 0016. The funny thing is when I use an online converter, the first hex string returns the correct UTF-8 string, but the second one returns unicode periods instead of regular periods.