[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Streamreader interpreting special characters incorrectly

Posted on 2007-07-26
7
Medium Priority
?
715 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:JaimeH
  • 4
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
vilimed earned 2000 total points
ID: 19572683
StreamReader reader = new StreamReader (data, System.Text.Encoding.GetEncoding(1250));
0
 
LVL 3

Expert Comment

by:vilimed
ID: 19572687
reader.CurrentEncoding = System.Text.Encoding.GetEncoding(1250);
0
 
LVL 3

Expert Comment

by:vilimed
ID: 19572709
sorry in vb
Dim sr As StreamReader = New StreamReader("TestFile.txt", System.Text.Encoding.GetEncoding(1250))
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:JaimeH
ID: 19572714
Thanks vilimed,

Your answer was simple, taciturn and most of all it worked.

I'm much obliged 8 [tips hat]
0
 

Author Comment

by:JaimeH
ID: 19573454
Isn't 1250 Central European?  I used 1252 in the end.
0
 
LVL 3

Expert Comment

by:vilimed
ID: 19573468
yes 1250 is Central European. I am from Central European.-))
0
 

Expert Comment

by:jaimehy
ID: 19580925
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
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question