I also use this 8-bit based arrays assumption in my sockets implementation, but javascript strings are really 16bit.  I think direct 16bit->binary is usually not what the user expects (would receive 0-value bytes on the other end between each char), but I do think this could be a problem with some unicode input.

I think the solution is to find a JS lib that converts a js-string into a UTF-8 encoded ArrayBuffer.