martynsmith / node-irc

NodeJS IRC client library
GNU General Public License v3.0
1.32k stars 425 forks source link

Long lines are split by character, not byte #507

Open Sanqui opened 7 years ago

Sanqui commented 7 years ago

Messages sent to IRC are split due to the IRC command length limit of 512 bytes. This appears to be done by the _splitLongLines function.

The current splitting method seems to count Unicode characters rather than bytes, resulting in (possibly large) parts of the message disappearing. It needs to be changed to count bytes of the string encoded in utf-8.

Noticed with discord-irc, issue https://github.com/reactiflux/discord-irc/issues/199 (contains a test log). discord-irc is using node-irc version 0.5.2.