I have a C#.net console application which reads data from a text file and updates it to the database. The file will have Scandinavian characters and other language characters. This is how I read the file in my app
using (StreamReader sr = new StreamReader(openFileDialog1.FileName))
but this scrabled the output charcters
I tried using utf8 to read the file but it was returning characters similar to chinese.
using (StreamReader sr = new StreamReader(openFileDialog1.FileName,Encoding.UTF8))
Why is this not working?
Then I tried using the following and its returning the correct characters.
using (StreamReader sr = new StreamReader(openFileDialog1.FileName,Encoding.GetEncoding(1252)))
My question is will the last method help in converting all the characters from different languages or only scandinavain charcters.
I dont have much idea on encoding if someone can explain me how it works. It would be very helpful.