To: vim_dev@googlegroups.com Subject: Patch 8.0.0850 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0850 Problem: MS-Windows: Depending on the console encoding, an error message that is given during startup may be broken. Solution: Convert the message to the console codepage. (Yasuhiro Matsumoto, closes #1927) Files: src/message.c *** ../vim-8.0.0849/src/message.c 2017-08-03 14:49:22.614906252 +0200 --- src/message.c 2017-08-03 17:36:23.428335370 +0200 *************** *** 2628,2637 **** char_u *s = str; char_u buf[4]; char_u *p; - #ifdef WIN3264 if (!(silent_mode && p_verbose == 0)) mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */ #endif while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { --- 2628,2656 ---- char_u *s = str; char_u buf[4]; char_u *p; #ifdef WIN3264 + # if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + char_u *ccp = NULL; + + # endif if (!(silent_mode && p_verbose == 0)) mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */ + + # if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + if (enc_codepage >= 0 && (int)GetConsoleCP() != enc_codepage) + { + int len; + WCHAR *widestr = (WCHAR *)enc_to_utf16(str, &len); + + if (widestr != NULL) + { + WideCharToMultiByte_alloc(GetConsoleCP(), 0, widestr, len, + (LPSTR *)&ccp, &len, 0, 0); + vim_free(widestr); + s = str = ccp; + } + } + # endif #endif while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { *************** *** 2675,2680 **** --- 2694,2702 ---- msg_didout = TRUE; /* assume that line is not empty */ #ifdef WIN3264 + # if defined(FEAT_MBYTE) && !defined(FEAT_GUI_MSWIN) + vim_free(ccp); + # endif if (!(silent_mode && p_verbose == 0)) mch_settmode(TMODE_RAW); #endif *** ../vim-8.0.0849/src/version.c 2017-08-03 17:06:40.977493439 +0200 --- src/version.c 2017-08-03 17:27:44.212158777 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 850, /**/ -- Windows M!uqoms /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///