-
Text Encoding
Hello,
When using File.CreateText() for creating a text file, the Unicode (UTF-8) is used. But I need to create a text file using another encoding (namely, Hebrew-Windows), because the created file is supposed to serve an input to another program which can't deal with Unicode. How can I set the desired encoding?
-
Re: Text Encoding
You have to deal with concrete code page and stream enconding.
Look at this example for inspiration:
Code:
System.IO.FileStream fs = System.IO.File.OpenWrite("file.txt");
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(fs, System.Text.Encoding.GetEncoding(1255)))
{
sw.WriteLine("some text");
}
1255 should be hebrew code page. But I cannot check it. I don't know anything from hebrew language.
-
Re: Text Encoding