c# 如何生成utf8格式的文件,这段代码有什么问题,达人给指点下吧
public void createuf8()
{
//
string path = @"D:\MUTRAN\SC\s20100126184127MU5312.snd";
// Delete the file if it exists.
if (File.Exists(path))
{
File.Delete(path);
}
//Create the file.
using (FileStream fs = new FileStream(path, FileMode.Create))
{
String unicodeString = "B-3333#MU9999#YYYY-MM-DD 1 ";
Byte[] data = new UTF8Encoding().GetBytes(unicodeString);
fs.Write(data, 0, data.Length);
}
}