Click here to Skip to main content
15,902,863 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
mav.northwind21-Jun-05 21:29
mav.northwind21-Jun-05 21:29 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
anderslundsgard21-Jun-05 22:21
anderslundsgard21-Jun-05 22:21 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
Anonymous21-Jun-05 21:14
Anonymous21-Jun-05 21:14 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
anderslundsgard21-Jun-05 22:19
anderslundsgard21-Jun-05 22:19 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
Sebastian Schneider21-Jun-05 23:26
Sebastian Schneider21-Jun-05 23:26 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
anderslundsgard21-Jun-05 23:38
anderslundsgard21-Jun-05 23:38 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
Carsten Zeumer22-Jun-05 3:01
Carsten Zeumer22-Jun-05 3:01 
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
Mike Dimmick22-Jun-05 3:03
Mike Dimmick22-Jun-05 3:03 
You need to know which encoding was used for these letters. It will probably be Windows-1252[^]. The default for StreamReader is UTF-8.

Check a binary view of the file (you can use the arrow to the right of the Open button in VS, select Open With..., then choose Binary Editor) to see what the values of those characters are. If it's 1252, å should be 0xE5 (229), ä should be 0xE4 (228) and ö should be 0xF6 (246). However, it could conceivably be an old DOS/OEM codepage, in which case it's likely to be either 437[^] or 850[^]. In both of these, å = 0x86 (134), ä = 0x84 (132), and ö = 0x94 (148).

If it's something more obscure you may be able to find it at FileFormat.Info[^]. Input the Unicode value of the characters (the hex values I've given for 1252).

When you've worked out what code page you're dealing with, use the following:
StreamReader sr =
   new StreamReader( 
      file,
      System.Text.Encoding.GetEncoding(1252)
   );
Replace 1252 with the correct code page number.

Stability. What an interesting concept. -- Chris Maunder
GeneralRe: Reading å, ä, ö from file with StreamReader Pin
anderslundsgard22-Jun-05 20:54
anderslundsgard22-Jun-05 20:54 
GeneralApplication design (XML) Pin
therealmccoy21-Jun-05 18:56
therealmccoy21-Jun-05 18:56 
GeneralRe: Application design (XML) Pin
IamJunk21-Jun-05 21:02
IamJunk21-Jun-05 21:02 
GeneralRe: Application design (XML) Pin
Marc Clifton22-Jun-05 1:48
mvaMarc Clifton22-Jun-05 1:48 
GeneralApplication design (data tier) Pin
therealmccoy21-Jun-05 18:47
therealmccoy21-Jun-05 18:47 
QuestionHow can I include a c#.net code in vb.net code Pin
Rahul.P.Menon21-Jun-05 18:19
sussRahul.P.Menon21-Jun-05 18:19 
AnswerRe: How can I include a c#.net code in vb.net code Pin
Christian Graus21-Jun-05 18:36
protectorChristian Graus21-Jun-05 18:36 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Rahul.P_Menon21-Jun-05 19:08
sussRahul.P_Menon21-Jun-05 19:08 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Christian Graus21-Jun-05 19:11
protectorChristian Graus21-Jun-05 19:11 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Rahul.P.Menon21-Jun-05 22:12
sussRahul.P.Menon21-Jun-05 22:12 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Dave Kreskowiak22-Jun-05 5:15
mveDave Kreskowiak22-Jun-05 5:15 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Christian Graus22-Jun-05 16:38
protectorChristian Graus22-Jun-05 16:38 
AnswerRe: How can I include a c#.net code in vb.net code Pin
J4amieC21-Jun-05 22:07
J4amieC21-Jun-05 22:07 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Dave Kreskowiak22-Jun-05 5:13
mveDave Kreskowiak22-Jun-05 5:13 
GeneralRe: How can I include a c#.net code in vb.net code Pin
Christian Graus22-Jun-05 16:36
protectorChristian Graus22-Jun-05 16:36 
Questionsaperate and run for voice these two functions? Pin
umair1121-Jun-05 17:45
umair1121-Jun-05 17:45 
AnswerRe: saperate and run for voice these two functions? Pin
Christian Graus21-Jun-05 18:06
protectorChristian Graus21-Jun-05 18:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.