XmlTextReader.Encoding 属性
定义
获取文档的编码。Gets the encoding of the document.
public:
property System::Text::Encoding ^ Encoding { System::Text::Encoding ^ get(); };
public System.Text.Encoding? Encoding { get; }
public System.Text.Encoding Encoding { get; }
member this.Encoding : System.Text.Encoding
Public ReadOnly Property Encoding As Encoding
属性值
编码值。The encoding value. 如果不存在任何编码属性且不存在字节顺序标记,则这将默认为 UTF-8。If no encoding attribute exists, and there is no byte-order mark, this defaults to UTF-8.
注解
备注
从 .NET Framework 2.0 开始,我们建议 XmlReader 使用方法创建实例 XmlReader.Create 以利用新功能。Starting with the .NET Framework 2.0, we recommend that you create XmlReader instances by using the XmlReader.Create method to take advantage of new functionality.
由于 XmlTextReader 使用 System.Text.Encoding 类,因此 XmlTextReader 还支持该类支持的所有编码。Because XmlTextReader uses the System.Text.Encoding class, XmlTextReader also supports all encodings supported by that class. 这种情况的例外是将 <?xml 序列映射到不同于 utf-8 的字节值的任何编码,如 utf-7 或 EBCDIC。The exception to this is any encoding, such as UTF-7 or EBCDIC, that maps the <?xml sequence to different byte values than UTF-8.