Get Chinese data form the clipboard with a parser in C# -
what dataformat should use if have parse data in clipboard contains chinese?
currently i'm using following code parse data datagrid
.
object clipboardrawdata = null; parseformat parseformat = null; idataobject dataobj = system.windows.clipboard.getdataobject(); if ((clipboardrawdata = dataobj.getdata(dataformats.commaseparatedvalue)) != null) { parseformat = parsecsvformat; } else if ((clipboardrawdata = dataobj.getdata(dataformats.text)) != null) { parseformat = parsetextformat; } string rawdatastr = clipboardrawdata string;
rawdatastr
returns gibberish if clipboard data in chinese
simply use dataformats.unicodetext
. dataformats.text
try use ansi encoding fail on chinese symbols.
Comments
Post a Comment