UTF8的問題

  File.WriteAllText(fileName, sb.ToString(), System.Text.Encoding.UTF8);

            //using (StreamWriter sw = File.CreateText(fileName))
            //{
            //    sw.Write(sb.ToString());
            //    sw.Flush();
            //    sw.Close();

            //}

  sb中有中文,開始的時候使用的是注釋部分的代碼,發現文件中存在亂碼,后來修改為 上面的代碼,解決問題。

原文地址:https://www.cnblogs.com/wonder223/p/2779242.html