- //读取
- string res = File.ReadAllText(filepath, Encoding.GetEncoding("UTF-8"));
- //写入
- FileStream file = new FileStream(outputfilepath, FileMode.OpenOrCreate);
- StreamWriter sw = new StreamWriter(file, Encoding.Unicode);
- sw.Write(output2);
- sw.Flush();
- sw.Close();
- file.Close();
- //该片段来自于http://www.codesnippet.cn/detail/1808201614943.html
来源: http://www.codesnippet.cn/detail/1808201614943.html