Hi,
The current version of vim doesn't handle non-utf8 multibyte encodings
such as EUC and/or GBK in FreeBSD. Cursor moves around weird places
inside a character and the last character on each lines disappears
sometimes.
This problem is due to vim's dependency to undefined behavior of
mblen(3). Looking vim's source code mbyte.c:653, the routine assumes
that mblen(3) isn't stateful. On glibc or Solaris libc, mblen(3)
does not change the internal state when EILSEQ or EINVAL is occurred.
But FreeBSD libc changes the internal state even when it meets an
error. The mblen(3) behavior is undefined in POSIX [1] and none
of each libc implementations are wrong. So I think it's required
to reset multibyte states before a mblen(3) call to work the routine
free from implementation.
My patch is attached.
[1] http://www.opengroup.org/onlinepubs/009695399/functions/mblen.html
Hye-Shik