]> granicus.if.org Git - vim/commitdiff
patch 8.1.0879: MS-Windows: temp name encoding can be wrong v8.1.0879
authorBram Moolenaar <Bram@vim.org>
Fri, 8 Feb 2019 11:21:30 +0000 (12:21 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 8 Feb 2019 11:21:30 +0000 (12:21 +0100)
Problem:    MS-Windows: temp name encoding can be wrong.
Solution:   Convert from active code page to 'encoding'. (Ken Takata,
            closes #3520, closes #1698)

src/fileio.c
src/version.c

index bf724f642fcca5fcec01aab6796266d98917bb8d..446ae7edf8c7e9709970010d332ed704b2f2883b 100644 (file)
@@ -7470,6 +7470,24 @@ vim_tempname(
        for (p = retval; *p; ++p)
            if (*p == '\\')
                *p = '/';
+
+#if defined(FEAT_MBYTE) && defined(WIN3264)
+    if (enc_utf8)
+    {
+       int     len;
+       char_u  *pp = NULL;
+
+       // Convert from active codepage to UTF-8 since mch_call_shell()
+       // converts command-line to wide string from encoding.
+       acp_to_enc(retval, (int)STRLEN(retval), &pp, &len);
+       if (pp != NULL)
+       {
+           vim_free(retval);
+           return pp;
+       }
+    }
+#endif
+
     return retval;
 
 # else /* WIN3264 */
index 6a8ba37551ac3bc1a8954d2205a435d0c695928e..f1205f12ddf13f1583585fde2af6b97a27cd95f1 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    879,
 /**/
     878,
 /**/