diff src/winclip.c @ 5714:22d7af9ff3e5 v7.4.202

updated for version 7.4.202 Problem: MS-Windows: non-ASCII font names don't work. Solution: Convert between the current code page and 'encoding'. (Ken Takata)
author Bram Moolenaar <bram@vim.org>
date Wed, 12 Mar 2014 19:24:37 +0100
parents 7b20dc804164
children 33ba2adb6065
line wrap: on
line diff
--- a/src/winclip.c
+++ b/src/winclip.c
@@ -797,4 +797,29 @@ acp_to_enc(str, str_size, out, outlen)
 	vim_free(widestr);
     }
 }
+
+/*
+ * Convert from 'encoding' to the active codepage.
+ * Input is "str[str_size]".
+ * The result is in allocated memory: "out[outlen]".  With terminating NUL.
+ */
+    void
+enc_to_acp(str, str_size, out, outlen)
+    char_u	*str;
+    int		str_size;
+    char_u	**out;
+    int		*outlen;
+
+{
+    LPWSTR	widestr;
+    int		len = str_size;
+
+    widestr = (WCHAR *)enc_to_utf16(str, &len);
+    if (widestr != NULL)
+    {
+	WideCharToMultiByte_alloc(GetACP(), 0, widestr, len,
+						(LPSTR *)out, outlen, 0, 0);
+	vim_free(widestr);
+    }
+}
 #endif