encoding problems with clipboard.getdata

N

nitm

hi,

i'm using the clipboard to get the data from a word document in html format.
it works great but the data i get seems to be in the wrong encoding (the
text looks like a long sequance of wierd signs i.e.: ??©?¤??).

the document is in hebrew and (i guess) that this is the reason (when i test
it with english it works great).

here's my code:
Encoding hebEncoding = Encoding.GetEncoding("iso-8859-8");
System.IO.MemoryStream vMemoryStream = Clipboard.GetData("Html Format") as
System.IO.MemoryStream;
vMemoryStream.Position = 0;
byte[] vBytes = new byte[vMemoryStream.Length];
vMemoryStream.Read(vBytes, 0, (int)vMemoryStream.Length);
return hebEncoding.GetString(vBytes);

i narrowed the problem to this part: Clipboard.GetData(DataFormats.Html)
if i change the DataFormats.Html to Dataformats.Text it all works great and
i can see the hebrew just right.. when it's Html it's messed up.

so, as i see it, the problem is probably with the html converter.
the bigger problem is that i have no idea how to work around this problem
and i
can't find anything on the web that is remotely similar to my problem!

anyone can think of something?

thank!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top