I'm trying to put Unicode UTF-8 data directly onto the Windows clipboard. Why does this not work:
HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 16);
unsigned char *px = (unsigned char*) GlobalLock(hGlobal);
px = 0xe0;
px = 0xa0;
px = 0xb0;
px = 0x00;
Data always seems to go on the Clipboard as UTF-16, ie 2 bytes per code.
Any suggestions how I can achieve?
Edited 1-Oct-11 12:48pm
CF_UNICODETEXT states that the data you're passing is a Unicode text, which is 2 bytes per character.
UTF-8 is multibyte per character.
They are not the same.
Convert your UTF-8 text to Unicode first, or use CF_TEXT instead.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)