0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

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 #8347)
This commit is contained in:
K.Takata 2021-06-08 18:32:36 +02:00 committed by Bram Moolenaar
parent c41badb748
commit dc73b4b75d
2 changed files with 6 additions and 4 deletions

View 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 int nArgsW = 0;
static LPWSTR *ArglistW = NULL; static LPWSTR *ArglistW = NULL;
@ -7601,8 +7601,8 @@ get_cmd_argsW(char ***argvp)
{ {
int len; int len;
// Convert each Unicode argument to the current codepage. // Convert each Unicode argument to UTF-8.
WideCharToMultiByte_alloc(GetACP(), 0, WideCharToMultiByte_alloc(CP_UTF8, 0,
ArglistW[i], (int)wcslen(ArglistW[i]) + 1, ArglistW[i], (int)wcslen(ArglistW[i]) + 1,
(LPSTR *)&argv[i], &len, 0, 0); (LPSTR *)&argv[i], &len, 0, 0);
if (argv[i] == NULL) if (argv[i] == NULL)
@ -7678,7 +7678,7 @@ set_alist_count(void)
/* /*
* Fix the encoding of the command line arguments. Invoked when 'encoding' * 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'. * and convert them to 'encoding'.
*/ */
void void

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2962,
/**/ /**/
2961, 2961,
/**/ /**/