0
Fixed

Clipboard copy/paste cyrillic text

Vorland 12 years ago updated by Alex Jenter 12 years ago 3

When copying note to a clipboard (at the chosen English keyboard), the inserting of the copied note from a clipboard to another application (I tried application "Bred") has a bug: instead of inserting Cyrillic symbols the "question marks" are inserted. At chosen Russian keyboard - everything is normal. It's known Problem - if I am not mistaken, it is necessary to report about the codepage of a copied note to the Windows Clipboard. Whether it is possible to correct? (Inserting Clipboard into Windows WordPad works without bug - probably, the problem is in "old" applications)

I found examples, how to fix this copy/past behavior:
C++ Source for non-unicode application (compiled in "C++ Builder" ):

const AnsiString strData="string to copy";

// open the system clipboard and delete all the data in it
if(!OpenClipboard(NULL))
{
//Error
throw Exception( "" );
}
EmptyClipboard();

//allocate memory in global heap for buffer
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, strData.Length() + 1);
if(!hglbCopy)
{
CloseClipboard();
//Error
throw Exception( "" );
}

//lock the memory object to guarantee that nobody can move or discard it
LPTSTR lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
if(!lptstrCopy)
{
CloseClipboard();
GlobalFree(hglbCopy);
//Error
throw Exception( "" );
}

// copy the buffer into locked memory object
memcpy(lptstrCopy, strData.data(), strData.Length());
lptstrCopy += strData.Length();
*lptstrCopy = 0; // string null terminator

//unlock the memory object
GlobalUnlock(hglbCopy);

//put the data into clipboard in text format
HANDLE hClipData = SetClipboardData(CF_TEXT, hglbCopy);
if(!hClipData)
{
CloseClipboard();
GlobalFree(hglbCopy);
//Error
throw Exception( "" );
}

//set locale for text in the clipboard
hClipData = SetClipboardData(CF_LOCALE, hglbCopy);
if(!hClipData)
{
CloseClipboard();
GlobalFree(hglbCopy);
//Error
throw Exception( "" );
}

//close the system clipboard
CloseClipboard();

Answer

Answer
Fixed

Actually this has been fixed in 2.1

Thanks for the report!

Could you please post a link where we can get this "Bred" application for testing purposes?

All other applications seem to work fine. Thanks!


Also, do any other applications exhibit this bug? Which ones?

I use BRED version 3.0.3U
"Bred" application URLs:

http://www.astonshell.ru/freeware/bred3/
http://www.astonshell.ru/files/bred3.0.3-setup_2k.exe

Some another issues of this copy/paste bug:

http://dvnuance.net/?p=973
http://social.technet.microsoft.com/Forums/ru-RU/xpru/thread/4f1b3777-30e6-44dd-a646-21f68d7c80b5/
http://rxlib.ru/forums/index.php?act=ST&f=3&t=4078&s=6a0acd123561bc5ed888224d6e218eb2


I have this bug (or annoying behavior of clipboard?) on Windows XP SP3. I think, that is not bug of CN, but switching of keyboard layouts is very  annoying... 

Thanks for the info! We'll fix this problem in the next update!


Answer
Fixed

Actually this has been fixed in 2.1