To: vim_dev@googlegroups.com Subject: Patch 8.2.2962 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2962 Problem: MS-Windows command line arguments have wrong encoding. Solution: Always use utf-8 in get_cmd_argsW(). (Ken Takata, closes #8347) Files: src/os_win32.c *** ../vim-8.2.2961/src/os_win32.c 2021-06-02 13:28:11.435120452 +0200 --- src/os_win32.c 2021-06-08 18:30:57.907654229 +0200 *************** *** 7558,7564 **** /* ! * The command line arguments in UCS2 */ static int nArgsW = 0; static LPWSTR *ArglistW = NULL; --- 7558,7564 ---- /* ! * The command line arguments in UTF-16 */ static int nArgsW = 0; static LPWSTR *ArglistW = NULL; *************** *** 7601,7608 **** { int len; ! // Convert each Unicode argument to the current codepage. ! WideCharToMultiByte_alloc(GetACP(), 0, ArglistW[i], (int)wcslen(ArglistW[i]) + 1, (LPSTR *)&argv[i], &len, 0, 0); if (argv[i] == NULL) --- 7601,7608 ---- { int len; ! // Convert each Unicode argument to UTF-8. ! WideCharToMultiByte_alloc(CP_UTF8, 0, ArglistW[i], (int)wcslen(ArglistW[i]) + 1, (LPSTR *)&argv[i], &len, 0, 0); if (argv[i] == NULL) *************** *** 7678,7684 **** /* * Fix the encoding of the command line arguments. Invoked when 'encoding' ! * has been changed while starting up. Use the UCS-2 command line arguments * and convert them to 'encoding'. */ void --- 7678,7684 ---- /* * Fix the encoding of the command line arguments. Invoked when 'encoding' ! * has been changed while starting up. Use the UTF-16 command line arguments * and convert them to 'encoding'. */ void *** ../vim-8.2.2961/src/version.c 2021-06-07 22:04:48.406620074 +0200 --- src/version.c 2021-06-08 18:32:17.355483838 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2962, /**/ -- SOLDIER: Where did you get the coconuts? ARTHUR: Through ... We found them. SOLDIER: Found them? In Mercea. The coconut's tropical! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///