CodePagesEncodingProvider 类

定义

为只在桌面 .NET Framework 中可用的代码页提供对编码提供程序的访问权限。Provides access to an encoding provider for code pages that otherwise are available only in the desktop .NET Framework.

public ref class CodePagesEncodingProvider sealed : System::Text::EncodingProvider
public ref class CodePagesEncodingProvider sealed
public sealed class CodePagesEncodingProvider : System.Text.EncodingProvider
[System.Security.SecurityCritical]
public sealed class CodePagesEncodingProvider
type CodePagesEncodingProvider = class
    inherit EncodingProvider
[<System.Security.SecurityCritical>]
type CodePagesEncodingProvider = class
Public NotInheritable Class CodePagesEncodingProvider
Inherits EncodingProvider
Public NotInheritable Class CodePagesEncodingProvider
继承
CodePagesEncodingProvider
继承
CodePagesEncodingProvider
属性

注解

Windows 桌面的 .NET Framework 支持大量的 Unicode 和代码页编码。The .NET Framework for the Windows desktop supports a large set of Unicode and code page encodings. 另一方面,.NET Core 仅支持以下编码:.NET Core, on the other hand, supports only the following encodings:

  • ASCII (代码页 20127) ,由 Encoding.ASCII 属性返回。ASCII (code page 20127), which is returned by the Encoding.ASCII property.

  • ISO-8859-1 (代码页 28591) 。ISO-8859-1 (code page 28591).

  • UTF-7 (代码页 65000) ,由 Encoding.UTF7 属性返回。UTF-7 (code page 65000), which is returned by the Encoding.UTF7 property.

  • UTF-8 (代码页 65001) ,由 Encoding.UTF8 属性返回。UTF-8 (code page 65001), which is returned by the Encoding.UTF8 property.

  • UTF-16 和 UTF-16LE (代码页 1200) ,由 Encoding.Unicode 属性返回。UTF-16 and UTF-16LE (code page 1200), which is returned by the Encoding.Unicode property.

  • UTF-16BE (代码页 1201) ,它是通过调用 UnicodeEncoding.UnicodeEncoding UnicodeEncoding.UnicodeEncoding 值为的或构造函数进行实例化的 bigEndian trueUTF-16BE (code page 1201), which is instantiated by calling the UnicodeEncoding.UnicodeEncoding or UnicodeEncoding.UnicodeEncoding constructor with a bigEndian value of true.

  • 32和 32LE (代码页 12000) ,由 Encoding.UTF32 属性返回。UTF-32 and UTF-32LE (code page 12000), which is returned by the Encoding.UTF32 property.

  • 32BE (代码页 12001) ,它是通过调用 UTF32Encoding 具有参数的构造函数 bigEndiantrue 在方法调用中提供的值来进行实例化的。UTF-32BE (code page 12001), which is instantiated by calling an UTF32Encoding constructor that has a bigEndian parameter and providing a value of true in the method call.

除代码页20127之外,不支持代码页编码。Other than code page 20127, code page encodings are not supported.

CodePagesEncodingProvider类扩展 EncodingProvider ,使这些代码页可用于 .net Core。The CodePagesEncodingProvider class extends EncodingProvider to make these code pages available to .NET Core. 若要使用这些附加代码页,请执行以下操作:To use these additional code pages, you do the following:

EncodingProvider注册对象之后,通过调用的重载可以使用它支持的编码 Encoding.GetEncoding ; 不应调用 EncodingProvider.GetEncoding 重载。After an EncodingProvider object is registered, the encodings that it supports are available by calling the overloads of Encoding.GetEncoding; you should not call the EncodingProvider.GetEncoding overloads.

属性

Instance

获取桌面 .NET Framework 支持但当前 .NET Framework 平台不支持的代码页的编码提供程序。Gets an encoding provider for code pages supported in the desktop .NET Framework but not in the current .NET Framework platform.

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEncoding(Int32)

返回与指定代码页标识符关联的编码。Returns the encoding associated with the specified code page identifier.

GetEncoding(Int32, EncoderFallback, DecoderFallback)

返回与指定代码页标识符关联的编码。Returns the encoding associated with the specified code page identifier. 参数指定一个错误处理程序,用于处理无法编码的字符和无法解码的字节序列。Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.

(继承自 EncodingProvider)
GetEncoding(String)

返回与指定代码页名称关联的编码。Returns the encoding associated with the specified code page name.

GetEncoding(String, EncoderFallback, DecoderFallback)

返回与指定名称关联的编码。Returns the encoding associated with the specified name. 参数指定一个错误处理程序,用于处理无法编码的字符和无法解码的字节序列。Parameters specify an error handler for characters that cannot be encoded and byte sequences that cannot be decoded.

(继承自 EncodingProvider)
GetEncodings()

返回一个数组,其中包含 CodePagesEncodingProvider 支持的所有编码。Returns an array that contains all the encodings that are supported by the CodePagesEncodingProvider.

GetEncodings()

返回一个数组,其中包含 EncodingProvider 支持的所有编码。Returns an array that contains all the encodings that are supported by the EncodingProvider.

(继承自 EncodingProvider)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于