Closed ochaochaocha3 closed 9 years ago
Thank you for your contribution. I took your patch and simplified it slightly, You can check it out in the byte-split branch (https://github.com/cinchrb/cinch/blob/byte-split/lib/cinch/target.rb)
Could you please test that branch and see if it works correctly for you?
Thank you for improving my code. I added some test cases and fixed the position calculation algorithm slightly (please see the commit message of ecb4d1c).
And I changed to use "\z" (substitute character; 0x1A) as the mark of a space. Because "\u00A0" is a 2-byte character, it shorten split messages.
I'm afraid you messed up when you merged my byte-split branch into your branch. Now there's two implementations of the message splitting, once in the split_message
method, and once in send
, the latter containing your original code, not my modified one.
I'm sorry not to confirm the merge commit carefully. Could you please choose 8119249 or a new PR #190?
I've merged your changes as 7b8a0181a1f4445f834244912e07834567d0cb3a. I did rewrite and reorder them some, as well as add an encoding header to the target.rb test file, but all in all it should be pretty close to the state in #190 (just with more of the history preserved.)
Thanks for your contribution.
I fixed a bug in splitting messages containing multibyte characters.
Issue
For example, the following Japanese message got broken by split.
Previously Cinch::Target#send split such messages at the wrong position that was calculated from the number of characters instead of the byte size.