[英]StreamReader C# does not read å, ä, ö
I have a StreamReader
reading a file like below for reading a .csv
file:我有一个
StreamReader
读取如下文件以读取.csv
文件:
using (StreamReader sr = new StreamReader(filePath, System.Text.Encoding.GetEncoding("iso-8859-1")))
{
string line = string.Empty;
line = sr.ReadLine()
}
The first line of the file is: å ä ö Ü
(for testing purposes).文件的第一行是:
å ä ö Ü
(用于测试目的)。 However, when I try to read the file C# does not read the characters as it should:但是,当我尝试读取文件 C# 时,它不会读取应有的字符:
Any idea why that is?知道为什么吗?
Remove encoding or select the right one.去掉右边的编码或select。 I am using this syntax without any problem
我使用这种语法没有任何问题
string str = string.Empty;
using (StreamReader r = new StreamReader(@"C:\..."))
str = r.ReadToEnd();
ouput输出
å ä ö Ü
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.