Subject: bug#12051: 24.1; rcirc-send-message doesn't take multibyte into account.

From: Eli Zaretskii <[email-masked]>
Date: Thu, 16 Aug 2012 18:20:40 +0300

> From: Leo <[email-masked]>
> Cc: [email-masked]
> Date: Thu, 16 Aug 2012 11:16:04 +0800
> 
> On 2012-08-16 10:50 +0800, Eli Zaretskii wrote:
> >> By worst expansion, do you mean assuming each char to be 5 bytes?
> >
> > Yes.
> 
> The will split English text at the boundary of 84 chars which seems
> sub-optimal.

Why is it suboptimal?  (I don't know anything about rcirc.)

If it's important to be better in this case, you could detect it
(e.g., by matching the string against [:ascii:]).

Another ide is to use string-bytes to find out where to break a string
on a character boundary without exceeding the maximum allowed byte
count in a message.

> In the current implementation of rcirc-split-message, the inner loop
> might not be run if the encoding is utf-8, which we can assume to be 90%
> of the cases. So my suggestion is to leave it alone until we hit a real
> case of inefficiency. What do you think?

I'm okay with the current code if you are, but I still think a more
elegant solution should be possible.