To: vim-dev@vim.org Subject: Patch 6.3b.018 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.3b.018 Problem: The list of help files in the "local additions" table doesn't recognize utf-8 encoding. (Yasuhiro Matsumoto) Solution: Recognize utf-8 characters. Files: src/ex_cmds.c *** ../vim-6.3b.017/src/ex_cmds.c Sun May 16 22:38:45 2004 --- src/ex_cmds.c Mon May 31 12:28:31 2004 *************** *** 5093,5098 **** --- 5093,5101 ---- && (s = vim_strchr(IObuff + 1, '*')) != NULL) { + #ifdef FEAT_MBYTE + int this_utf = MAYBE; + #endif /* Change tag definition to a * reference and remove /. */ IObuff[0] = '|'; *************** *** 5101,5115 **** { if (*s == '\r' || *s == '\n') *s = NUL; ++s; } #ifdef FEAT_MBYTE ! /* Assume the help file is latin1 and * conversion to the current * 'encoding' may be required. */ vc.vc_type = CONV_NONE; ! convert_setup(&vc, ! (char_u *)"latin1", p_enc); if (vc.vc_type == CONV_NONE) /* No conversion needed. */ cp = IObuff; --- 5104,5135 ---- { if (*s == '\r' || *s == '\n') *s = NUL; + #ifdef FEAT_MBYTE + /* The text is utf-8 when a byte + * above 127 is found and no + * illegal byte sequence is found. + */ + if (*s >= 0x80 && this_utf != FALSE) + { + int l; + + this_utf = TRUE; + l = utf_ptr2len_check(s); + if (l == 1) + this_utf = FALSE; + s += l - 1; + } + #endif ++s; } #ifdef FEAT_MBYTE ! /* The help file is latin1 or utf-8; * conversion to the current * 'encoding' may be required. */ vc.vc_type = CONV_NONE; ! convert_setup(&vc, (char_u *)( ! this_utf == TRUE ? "utf-8" ! : "latin1"), p_enc); if (vc.vc_type == CONV_NONE) /* No conversion needed. */ cp = IObuff; *** ../vim-6.3b.017/src/version.c Sun May 30 23:00:59 2004 --- src/version.c Mon May 31 12:38:53 2004 *************** *** 643,644 **** --- 643,646 ---- { /* Add new patch number below this line */ + /**/ + 18, /**/ -- hundred-and-one symptoms of being an internet addict: 15. Your heart races faster and beats irregularly each time you see a new WWW site address in print or on TV, even though you've never had heart problems before. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///