I would like to know if there is an easy way to detect if the text on the clipboard is in ISO 8859 or UTF-8 ?
Here is my current code:
COleDataObject obj;
if (obj.AttachClipboard())
{
if (obj.IsDataAvailable(CF_TEXT))
{
HGLOBAL hmem = obj.GetGlobalData(CF_TEXT);
CMemFile sf((BYTE*) ::GlobalLock(hmem),(UINT) ::GlobalSize(hmem));
CString buffer;
LPSTR str = buffer.GetBufferSetLength((int)::GlobalSize(hmem));
sf.Read(str,(UINT) ::GlobalSize(hmem));
::GlobalUnlock(hmem);
//this is my string class
s->SetEncoding(ENCODING_8BIT);
s->SetString(buffer);
}
}
}