summaryrefslogtreecommitdiff
path: root/src/winclip.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-03-12 19:24:37 +0100
committerBram Moolenaar <Bram@vim.org>2014-03-12 19:24:37 +0100
commitb1692e2b8f074926f75b11e0d0a519d502b95c82 (patch)
treedb454a43dd131f9c2341a29e66691591b9271942 /src/winclip.c
parentaf6c131bf7f86dc85fbc2e4a79f2547786228126 (diff)
downloadvim-git-b1692e2b8f074926f75b11e0d0a519d502b95c82.tar.gz
updated for version 7.4.202v7.4.202
Problem: MS-Windows: non-ASCII font names don't work. Solution: Convert between the current code page and 'encoding'. (Ken Takata)
Diffstat (limited to 'src/winclip.c')
-rw-r--r--src/winclip.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/winclip.c b/src/winclip.c
index 0f110ffc5..f34c7d97f 100644
--- 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