XmlTextWriter 儲存XML檔案 為UTF-8 (無BOM)

XmlTextWriter 儲存XML檔案 為UTF-8 (無BOM)

含BOM:
new XmlTextWriter(@"file.xml", System.Text.Encoding.UTF8)

不含BOM:
new XmlTextWriter(@"file.xml", new System.Text.UTF8Encoding(false) )


相關資料參考:
http://social.msdn.microsoft.com/forums/en-US/xmlandnetfx/thread/9b8d1603-3e76-4b09-b9a8-e529d93f9e0a
解決 XmlWriter 輸出的 XML 無法正確設定 Encoding 的問題
http://blog.miniasp.com/post/2009/10/XmlWriter-and-Encoding-issues.aspx