[Win32utils-devel] Fwd: win32-clipboard and Unicode zero bytes
Park Heesob
phasis at nownuri.net
Thu Feb 2 07:07:16 EST 2006
Hi,
----- Original Message -----
From: "Daniel Berger" <djberg96 at yahoo.com>
To: <win32utils-devel at rubyforge.org>
Sent: Thursday, February 02, 2006 9:39 AM
Subject: [Win32utils-devel] Fwd: win32-clipboard and Unicode zero bytes
> Hi all,
>
> I'm forwarding this message from Brian Marick. If you
> run this test script and then paste the results into a
> Unicode aware text editor, you'll notice that it only
> prints one character instead of three.
>
> I tried changing the strlen to _tcslen and strcpy to
> _tcscpy, but that didn't help. I mucked around a bit
> with the MultiByteToWideChar function, too, but didn't
> have any luck.
>
> Any ideas?
>
> Thanks,
>
> Dan
>
Here is some patches of clipboard.c
Line 70:
hMem = GlobalAlloc(GHND, strlen(data) + sizeof(TCHAR*));
to
hMem = GlobalAlloc(GHND, RSTRING(rbData)->len + sizeof(TCHAR*));
Line 75:
strcpy((TCHAR *)GlobalLock(hMem), data);
to
memcpy((TCHAR *)GlobalLock(hMem), data, RSTRING(rbData)->len);
HTH,
Park Heesob
More information about the win32utils-devel
mailing list