Win32 clipboard and pasting unicode from other apps
I think I know why gvim on Win32 breaks unicode cut/copy and pasting from
other apps, but I don't know enough (yet) about the vim internals and
especially multibyte to fix it.
I used ClipSpy from http://home.inreach.com/mdunn/ and copied from a
Japanese MS Word document to see exactly what was put on the clipboard. The
text was put on the clipboard in two formats: CF_TEXT, which produced a
series of '?' characters (0x3F), which was presumably because the japanese
characters do not exist in ANSI. However, the correct text was put on the
clipboard in the CF_UNICODETEXT format, which is presumably UTF-8.
The problem is in os_mswin.c, the function clip_mch_request_selection (line
755) only requests the CF_TEXT format from the clipboard. I would imagine
the best way around this would be to modify this function so that it uses
the CF_UNICODETEXT format in preference to the CF_TEXT format if set
encoding is a multibyte format.
My problems are:
1. I don't know how to determine whether or not I want the CF_TEXT format or
the CF_UNICODETEXT. Presumably I look at the value of encoding and determine
it somehow from that? Is there a function to do this?
2. I don't know what to do with the CF_UNICODETEXT once I've retrieved it
from the clipboard! Will it need converting to another format? Possibly the
code in that function will work as is, I don't know enough about the
Anyway, if this helps anyone or if anyone can help me, please let me know!
Accenture HR Services (formerly e-peopleserve)
Learning Management Systems
Tel: 01785 762750
This electronic message contains information from e-peopleserve, which may
be privileged and/or confidential. The information is intended to be for the
use of the individual(s) or entity named above. If you are not the intended
recipient, be aware that any disclosure, copying distribution or use of the
contents of this information is prohibited. If you have received this
electronic message in error, please notify us by telephone or e-mail (to the
number or address above) immediately.
- Glenn Maynard wrote:
> > Can you check the changes for enc_codepage and send me a patch again?That has a catch 42 problem: I would like to test the whole thing before
> > Preferably against the current version with the Unicode clipboard patch
> > included.
> I'll run over it and send it again. It'd be easiest if you could commit
> the clipboard patch to CVS, so I can diff from there.
sending the patch into the world.
> > I'm actually more worried about plain mistakes in the code. I did someI didn't change the way it handles the clipboard. It's mostly the
> > cleaning up and could not test it all.
> I got it to apply (along with the strlen fix), and it's worked in a few
> cursory tests (copying and pasting JP text with enc=utf-8 and enc=cp932).
> I suspect you'll want more testing in 9x, which I can't do here ...
various conversions that need to be checked, including iconv().
hundred-and-one symptoms of being an internet addict:
156. You forget your friend's name but not her e-mail address.
/// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///