Converts a string into an ArrayBuffer where each character is represented by its UTF-16 code unit (lower 8 bits).
Parameters
str: string
The input string to convert.
Returns ArrayBuffer
An ArrayBuffer containing the UTF-8 encoded bytes of the input string.
Remarks
This function encodes each character of the string as a single byte, using the character's char code.
Characters with code points above 255 will be truncated to fit into a single byte.
For full Unicode support, consider using TextEncoder instead.
Converts a string into an ArrayBuffer where each character is represented by its UTF-16 code unit (lower 8 bits).