Fix handling of UTF8 chars in stomp-client-js (TORQUE-1086, TORQUE-1134)

The root of the problem was content-length is in bytes but the JS
client was treating it as character indexes.

This commit includes lots of other changes to get the stomp-client-js
basic_javascript_client_test.js running again.