• Shtml 中的UTF8 BOM问题


    最近使用到SSI技术,发现一个问题,即IE7,IE6在解析IIS生成的页面时,出现了错位,最后,把html粘贴到notepad++里面出现了一个问号,造成了页面的错位,经过大量的google,终于解决了,是由于BOM造成的,即不使用UTF-8编码,而是使用UTF-8 no bom进行编码,代码如下.

      using (XmlReader reader = System.Xml.XmlReader.Create(new System.IO.StringReader(xmlData)))

                {

                    using (FileStream fs = new FileStream(_module.Target, FileMode.Create))

                    {

                        Encoding utf8noBOM = new UTF8Encoding(false);   


                        using (TextWriter tw = new StreamWriter(fs, utf8noBOM))

                        {

                            xslt1.Transform(new XmlInput(reader), null, new XmlOutput(tw));

                            fs.Flush();

                        }

                     

                    }

                } 

  • 相关阅读:
    杭电ACM1.2.6 Decimal System
    杭电ACM1.2.7 GPA
    taro hook 倒计时setTimeout版
    taro hook 倒计时setInterval版
    Vuecli3内存溢出解决方案记录
    哈希
    hashmap和hashtable区别
    HashMap[转]
    JAVA中List、Map、Set
    C++和MATLAB混合编程DLL篇[转]
  • 原文地址:https://www.cnblogs.com/cpsing/p/1603994.html
Copyright © 2020-2023  润新知