P
Pierre Arnaud
Hi,
I am currently trying to read the contents of the Clipboard from
a WinForms application. I am specifically interested in the "HTML
Format" format which gets stored into the clipboard when I copy
a fragment of text containing the EURO character (Unicode 20AC)
in Word.
When calling DataObject.GetData ("HTML Format") I get a string as
result. The string does not, however, properly represent the data
stored in the clipboard.
The raw data (as seen with ClipSpy for instance) contains the
following UTF-8 byte stream :
.... E2 82 AC ...
This should decode to 20AC, since :
E2 = 1110'0010 -- 1110'zzzz
82 = 1000'0010 -- 10yy'yyyy
AC = 1010'1100 -- 10xx'xxxx
This is a 3-byte encoding sequence mapping to zzzz'yyyy'yyxx'xxxx,
which is 0010'0000'1010'1100 = 20AC = EURO Currency Symbol.
But the string returned by GetData is faulty at that point. It
contains the following, incorrectly decoded, characters :
0x00e2 0x201a
There seems to be a bug in the .NET Clipboard code implementation.
You can make my application (available at www.creativedocs.net)
crash if you copy a EURO symbol (with my keyboard layout, AltGr-E)
in Word and paste it to any text line in the application.
I'd be glad to have a work-around for this issue !
Pierre
I am currently trying to read the contents of the Clipboard from
a WinForms application. I am specifically interested in the "HTML
Format" format which gets stored into the clipboard when I copy
a fragment of text containing the EURO character (Unicode 20AC)
in Word.
When calling DataObject.GetData ("HTML Format") I get a string as
result. The string does not, however, properly represent the data
stored in the clipboard.
The raw data (as seen with ClipSpy for instance) contains the
following UTF-8 byte stream :
.... E2 82 AC ...
This should decode to 20AC, since :
E2 = 1110'0010 -- 1110'zzzz
82 = 1000'0010 -- 10yy'yyyy
AC = 1010'1100 -- 10xx'xxxx
This is a 3-byte encoding sequence mapping to zzzz'yyyy'yyxx'xxxx,
which is 0010'0000'1010'1100 = 20AC = EURO Currency Symbol.
But the string returned by GetData is faulty at that point. It
contains the following, incorrectly decoded, characters :
0x00e2 0x201a
There seems to be a bug in the .NET Clipboard code implementation.
You can make my application (available at www.creativedocs.net)
crash if you copy a EURO symbol (with my keyboard layout, AltGr-E)
in Word and paste it to any text line in the application.
I'd be glad to have a work-around for this issue !
Pierre