Re: mutt/1536: Segment fault with long lines when LANG=*.UTF-8
On Fri, 2005-08-05 at 04:45:02 +0200, Brendan Cully wrote:
> Looking at it a bit more closely I wonder if it could be done more
> efficiently. Is it possible to scan from the back of the buffer until
> mbrtowc returns n > 0, then trim the buffer to current_pos + n? Or am
> I missing some tricky multibyte issue? Seems a bit nicer than walking
> over every character of every line.
At least for UTF-8 it should be possible to do this, since the first
byte in a multibyte characters has a unique pattern that includes the
length. If we include (all) other multibyte encodings it may become
more complicated, I haven't checked yet.
Anders