以当前系统默认的编码写入文件

FilePatch = Path.Combine(movie.SaveFolderPatch, "电影资料.txt");
                    FileInfo fi = new FileInfo(FilePatch);
                    if (fi.Exists)
                        fi.Delete();
                    FileStream fs = File.Open(FilePatch, FileMode.OpenOrCreate, FileAccess.Write);
                    textSave = "[影片主演]";
                    textSave += crlf;
                    textSave += "主演=" + movie.Actor;
                    textSave += crlf;
                    textSave += "\r";
                    textSave += crlf;
                    textSave += "[影片类型]";
                    textSave += crlf;
                    textSave += "地区=" + movie.wherefrom.ToString();
                    textSave += crlf;
                    textSave += "清晰度=" + movie.ProgNotes;
                    textSave += crlf;
                    textSave += "类型=" + movie.TypeName;
                    textSave += crlf;
                    textSave += "\r";
                    textSave += crlf;
                    textSave += "[选填部分]";
                    textSave += crlf;
                    textSave += "推荐设定=" + movie.Recommend.ToString();
                    textSave += crlf;
                    textSave += "等级设定=" + movie.ProgLevel.ToString();
                    textSave += crlf;
                    textSave += "温馨提示=";
                    textSave += crlf;
                    textSave += "\r";
                    textSave += crlf;
                    textSave += "[影片介绍]";
                    textSave += crlf;
                    textSave += movie.Synopsis;
                    textSave += crlf;
                    Byte[] info = Encoding.Default.GetBytes(textSave);
                    fs.Write(info, 0, info.Length);
                    fs.Close();

  

原文地址:https://www.cnblogs.com/ChangTan/p/2323113.html