Janis Peksa

Janis Peksa

  • NA
  • 152
  • 50.8k

open file with utf-8

Apr 18 2011 5:42 AM
Hello, I have problem.
I have file with UTF-8 simbols in it.
I use some code to replace something.
And whan it saves the file utf-8 doesnt save.
It makes c ž š to ?
Can someone please help me.
I use this code:
StreamReader reader = new StreamReader("file.txt");
string content = reader.ReadToEnd();
reader.Close();

content =

StreamWriter

writer.Write(content);

writer.Close();



writer = new StreamWriter("file.txt");
Regex.Replace(content, ";", "|");

Answers (3)