node-json-socket icon indicating copy to clipboard operation
node-json-socket copied to clipboard

Multiple messages with international characters fail

Open hpalz opened this issue 6 years ago • 0 comments

When parsing multiple messages, the _handleData falls into this else case: https://github.com/sebastianseilund/node-json-socket/blob/master/lib/json-socket.js#L107

which will take a substring of the message based on the size defined before the message.

However, in the event of having international characters, the use of byteLength instead of string length will make the substring too long: https://github.com/sebastianseilund/node-json-socket/blob/master/lib/json-socket.js#L159

hpalz avatar Apr 04 '18 19:04 hpalz