diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-03-20 22:37:15 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-03-20 22:37:15 +0000 |
commit | 217ad920dd665ae74e055d870bfa05f73a20c2c8 (patch) | |
tree | c2fd40f30f58bee82ac2a42790c9042d4aabf505 /src/mbyte.c | |
parent | 2e4096b0775518cabcd9e295cf1d96b211699135 (diff) | |
download | vim-git-217ad920dd665ae74e055d870bfa05f73a20c2c8.tar.gz |
updated for version 7.0062
Diffstat (limited to 'src/mbyte.c')
-rw-r--r-- | src/mbyte.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mbyte.c b/src/mbyte.c index 89b53c2e5..695b651bb 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -990,6 +990,10 @@ dbcs_char2bytes(c, buf) { buf[0] = (unsigned)c >> 8; buf[1] = c; + /* Never use a NUL byte, it causes lots of trouble. It's an invalid + * character anyway. */ + if (buf[1] == NUL) + buf[1] = '\n'; return 2; } buf[0] = c; @@ -3087,7 +3091,14 @@ iconv_string(vcp, str, slen, unconvlenp) *to++ = '?'; if ((*mb_ptr2cells)((char_u *)from) > 1) *to++ = '?'; - l = (*mb_ptr2len_check)((char_u *)from); + if (enc_utf8) + l = utfc_ptr2len_check_len((char_u *)from, fromlen); + else + { + l = (*mb_ptr2len_check)((char_u *)from); + if (l > fromlen) + l = fromlen; + } from += l; fromlen -= l; } |