To: vim-dev@vim.org Subject: Patch 6.2.346 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.346 Problem: Win32 console: After using "chcp" Vim does not detect the different codepage. Solution: Use GetConsoleCP() and when it is different from GetACP() set 'termencoding'. Files: src/option.c *** ../vim-6.2.345/src/option.c Sun Mar 7 19:33:37 2004 --- src/option.c Thu Mar 11 17:25:32 2004 *************** *** 2803,2808 **** --- 2803,2828 ---- opt_idx = findoption((char_u *)"encoding"); options[opt_idx].def_val[VI_DEFAULT] = p_enc; options[opt_idx].flags |= P_DEF_ALLOCED; + + # if defined(WIN3264) && !defined(FEAT_GUI) + /* Win32 console: When GetACP() returns a different value from + * GetConsoleCP() set 'termencoding'. */ + if (GetACP() != GetConsoleCP()) + { + char buf[50]; + + sprintf(buf, "cp%ld", (long)GetConsoleCP()); + p_tenc = vim_strsave((char_u *)buf); + if (p_tenc != NULL) + { + opt_idx = findoption((char_u *)"termencoding"); + options[opt_idx].def_val[VI_DEFAULT] = p_tenc; + options[opt_idx].flags |= P_DEF_ALLOCED; + } + else + p_tenc = empty_option; + } + # endif } else { *** ../vim-6.2.345/src/version.c Thu Mar 11 21:03:40 2004 --- src/version.c Thu Mar 11 21:07:08 2004 *************** *** 639,640 **** --- 639,642 ---- { /* Add new patch number below this line */ + /**/ + 346, /**/ -- hundred-and-one symptoms of being an internet addict: 8. You spend half of the plane trip with your laptop on your lap...and your child in the overhead compartment. /// 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 ///