07.12.2013, 15:07 | #34 |
Moderator
|
Цитата:
X++: static void Main(string[] args) { string path = args[0]; System.Text.Encoding encodingUTF = System.Text.Encoding.UTF8; System.Text.Encoding encodingWin = System.Text.Encoding.ASCII; string content = ""; using (FileStream fs = File.Open(path, FileMode.Open)) { StreamReader sr = new StreamReader(fs, Encoding.Default); content = sr.ReadToEnd(); } using (FileStream fsw = File.OpenWrite(path)) { Byte[] info = new UTF8Encoding(true).GetBytes(content); fsw.WriteByte(0xEF); fsw.WriteByte(0xBB); fsw.WriteByte(0xBF); fsw.Write(info, 0, info.Length); } } |
|