summaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-08 12:21:30 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-08 12:21:30 +0100
commit0036201a1a096913840d3df8ff08eb58eaae90a6 (patch)
treea7fa6a443550f18aa7124e440d24927601dab847 /src/fileio.c
parenta02e3f65c52a2c8c987e7dcac5df1f8db9a7b0de (diff)
patch 8.1.0879: MS-Windows: temp name encoding can be wrongv8.1.0879
Problem: MS-Windows: temp name encoding can be wrong. Solution: Convert from active code page to 'encoding'. (Ken Takata, closes #3520, closes #1698)
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/fileio.c b/src/fileio.c
index bf724f642f..446ae7edf8 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -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 */