[removed the Vim maillist, this is development only] Edward L. Fox wrote:
> On 8/12/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: > > [...] > > You may have uncovered a bug that went unnoticed so far. Please try to > > discover what causes this problem. I can't guess why the last character > > is messed up, looks strange. > > I think I solved the problem! That was caused by iconv. > > size_t iconv(iconv_t cd, > char **inbuf, size_t *inbytesleft, > char **outbuf, size_t *outbytesleft); > > The parameter "inbytesleft" and "outbytesleft" should all include the > trailing '\0' byte. In the previous version of gvim, we passed the > parameter as the length of the string, excluding the trailing '\0'. So > it is 1 byte less than the correct value. This is not quite so. iconv() does not require the terminating NUL (it can also be used to convert part of a string). If it does require the NUL then iconv() is broken. That's unlikely though. Your change suggests that the length that is passed should be one more. Thus only one byte of the last double-byte character is currently converted. I can't quickly figure out where the wrong length is computed or passed. You probably already know the call stack, please have a look at where the length comes from. It's probably an off-by-one error somewhere. -- hundred-and-one symptoms of being an internet addict: 129. You cancel your newspaper subscription. /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///