开发者

Problem with csv special characters

开发者 https://www.devze.com 2023-02-16 05:13 出处:网络
I have a problem: I have read a csv file and store the contents into a datatable, and everything is ok. But when I show the contents of the datatable in a datagridview, when I have the symbols \"€\"

I have a problem: I have read a csv file and store the contents into a datatable, and everything is ok. But when I show the contents of the datatable in a datagridview, when I have the symbols "€" or "is, and ..." I only see a diamond with a question mark inside. How c开发者_高级运维an I fix this? thanks


You need to load the file with correct encoding.

Default is UTF8 but your file could be ASCII.

pass the encoding to the constructor of StreamReader :

StreamReader sw = new StreamReader (fileName, Encoding.ASCII);

Note

I do not know what encoding your file has but I just guess it is ASCII.

0

精彩评论

暂无评论...
验证码 换一张
取 消