Polskie litery w plikach txt

0

W jaki sposób wczytać wyraz z polskimi literami z pliku tekstowego do stringa?
Taki typowy programik:

System.IO.FileStream                file = null;
System.IO.StreamReader         reader = null;
string temp;

file = System.IO.File.OpenRead("plik.txt");               
reader = new System.IO.StreamReader(file);

temp = reader.ReadLine();
Console.WriteLine("Odczytano: {0}", temp);

zmienia "łóżko" na "ko"

0

Ustaw odpowiednie dla pliku kodowanie [CP1250, ISO-8859-2, UTF-8]

string content = null;
StreamReader tr = null;
tr = new StreamReader(path, System.Text.Encoding.GetEncoding("iso-8859-2"));
content = tr.ReadToEnd();
tr.Close();
0

dzięki. działa :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1