UTF8 encoding StreamWriter
using System;
using System.IO;
public class SWBuff
{
public static void Main(String[] args)
{
string logFile = "a.log";
string fileName = "a.log";
string textToAdd = "asdf";
FileStream fs = new FileStream(fileName, FileMode.CreateNew, FileAccess.Write, FileShare.None);
StreamWriter swFromFileTrueUTF8Buffer = new StreamWriter(fileName, true, System.Text.Encoding.UTF8,512);
swFromFileTrueUTF8Buffer.Write(textToAdd);
swFromFileTrueUTF8Buffer.Flush();
swFromFileTrueUTF8Buffer.Close();
}
}
Related examples in the same category