JaimeH
asked on
Streamreader interpreting special characters incorrectly
Hi all,
I'm using a streamreader to read a txt file in VB .NET, (for conversion of the data it contains to XML) and am coming up against the problem that the streamreader doesn't interpret special characters correctly: "á" is interpreted as "ý", while German vowels with Umlauts ("ä, ö, ü") are interpreted in &...; form (ä, ö ü, respectively).
The question is: Can I change the encoding the streamreader uses so that it interrprets the text correctly?"
Thanks very much in advance
JaimeHy
I'm using a streamreader to read a txt file in VB .NET, (for conversion of the data it contains to XML) and am coming up against the problem that the streamreader doesn't interpret special characters correctly: "á" is interpreted as "ý", while German vowels with Umlauts ("ä, ö, ü") are interpreted in &...; form (ä, ö ü, respectively).
The question is: Can I change the encoding the streamreader uses so that it interrprets the text correctly?"
Thanks very much in advance
JaimeHy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
reader.CurrentEncoding = System.Text.Encoding.GetEn coding(125 0);
sorry in vb
Dim sr As StreamReader = New StreamReader("TestFile.txt ", System.Text.Encoding.GetEn coding(125 0))
Dim sr As StreamReader = New StreamReader("TestFile.txt
ASKER
Thanks vilimed,
Your answer was simple, taciturn and most of all it worked.
I'm much obliged 8 [tips hat]
Your answer was simple, taciturn and most of all it worked.
I'm much obliged 8 [tips hat]
ASKER
Isn't 1250 Central European? I used 1252 in the end.
yes 1250 is Central European. I am from Central European.-))
What flavour of central European? I'm a westerner myself (about as far west as you can get without going for a swim in the Atlantic (Irish).
Thanks again!
Jaimeh
Thanks again!
Jaimeh