去掉BOM头 writer = new XmlTextWriter(stream, new UnicodeEncoding(false,false)); 如果是UTF8 writer = new XmlTextWriter(stream, new UTF8Encoding(false));