changeset 24848:c91b3e5b7896 v8.2.2962

patch 8.2.2962: MS-Windows command line arguments have wrong encoding Commit: https://github.com/vim/vim/commit/dc73b4b75de0134db3dffa6e631daf6cae817545 Author: K.Takata <kentkt@csc.jp> Date: Tue Jun 8 18:32:36 2021 +0200 patch 8.2.2962: MS-Windows command line arguments have wrong encoding Problem: MS-Windows command line arguments have wrong encoding. Solution: Always use utf-8 in get_cmd_argsW(). (Ken Takata, closes https://github.com/vim/vim/issues/8347)
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Jun 2021 18:45:05 +0200
parents dba15255d0a4
children a63c6581af98
files src/os_win32.c src/version.c
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2962,
+/**/
     2961,
 /**/
     2960,