1
Answer

Read Swedish characters

sabine

sabine

12y
1.6k
1
Hi,
I am reading a file using StreamReader but I am unable to read Swedish characters like ä, å, ö.
How can I add this ability?
Thank you
Answers (1)
0
Vulpes
NA 98.3k 1.5m 12y
It sounds like the file may use a single byte encoding (possibly Windows 1252) rather than UTF-8 which I think is the default for StreamReader and should be able to represent the Swedish characters.

See if it's any better if you specify an encoding in the constructor. Something like:

StreamReader sr  = new StreamReader(filePath, System.Text.Encoding.GetEncoding(1252));