]> granicus.if.org Git - vim/commitdiff
patch 8.2.2962: MS-Windows command line arguments have wrong encoding v8.2.2962
authorK.Takata <kentkt@csc.jp>
Tue, 8 Jun 2021 16:32:36 +0000 (18:32 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Jun 2021 16:32:36 +0000 (18:32 +0200)
Problem:    MS-Windows command line arguments have wrong encoding.
Solution:   Always use utf-8 in get_cmd_argsW(). (Ken Takata, closes #8347)

src/os_win32.c
src/version.c

index 874a2c69d8df64a5017d5f83450c2d46b45d5780..a966c53495fd2c6bad0c97631e212786e96316b6 100644 (file)
@@ -7558,7 +7558,7 @@ myresetstkoflw(void)
 
 
 /*
- * The command line arguments in UCS2
+ * The command line arguments in UTF-16
  */
 static int     nArgsW = 0;
 static LPWSTR  *ArglistW = NULL;
@@ -7601,8 +7601,8 @@ get_cmd_argsW(char ***argvp)
            {
                int     len;
 
-               // Convert each Unicode argument to the current codepage.
-               WideCharToMultiByte_alloc(GetACP(), 0,
+               // 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,7 +7678,7 @@ set_alist_count(void)
 
 /*
  * Fix the encoding of the command line arguments.  Invoked when 'encoding'
- * has been changed while starting up.  Use the UCS-2 command line arguments
+ * has been changed while starting up.  Use the UTF-16 command line arguments
  * and convert them to 'encoding'.
  */
     void
index bbf13dddf5c6c9fb6ec654da819122801be8fe78..08cb9c98e828478659ae4ef53db266c07d773c57 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2962,
 /**/
     2961,
 /**/