StreamReader C# does not read å, ä, ö
I have a StreamReader
reading a file like below for reading a .csv
file:
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:
Any idea why that is?
Remove encoding or select the right one. I am using this syntax without any problem
string str = string.Empty;
using (StreamReader r = new StreamReader(@"C:\..."))
str = r.ReadToEnd();
ouput
å ä ö Ü