Encoding utf8 = new UTF8Encoding(true);

参数表示是否带签名,

但此是否带签名在WriteAllBytes 无效,生成的永远是无签名的。

但在WriteAllText中有效。

 Encoding utf8 = new UTF8Encoding(true);
        ////utf8.s = "65001";

        //var utf8 = System.Text.Encoding.GetEncoding(65001);
        var bys = utf8.GetBytes("测试生成页面" + DateTime.Now.ToString());
        System.IO.File.WriteAllBytes(Server.MapPath("~/") + "b.html", bys);

        File.WriteAllText(Server.MapPath("~/") + "a.html", Encoding.UTF8.GetString(bys) + ",最新", new UTF8Encoding(true));

 

相关文章:

  • 2021-08-02
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-05-07
  • 2021-08-21
猜你喜欢
  • 2021-04-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2021-05-25
  • 2022-01-14
相关资源
相似解决方案