แก้ไข

แชร์ผ่าน


CodePagesEncodingProvider Class

Definition

Provides access to an encoding provider for code pages that otherwise are available only in the desktop .NET Framework.

public ref class CodePagesEncodingProvider sealed
public ref class CodePagesEncodingProvider sealed : System::Text::EncodingProvider
[System.Security.SecurityCritical]
public sealed class CodePagesEncodingProvider
public sealed class CodePagesEncodingProvider : System.Text.EncodingProvider
[<System.Security.SecurityCritical>]
type CodePagesEncodingProvider = class
type CodePagesEncodingProvider = class
    inherit EncodingProvider
Public NotInheritable Class CodePagesEncodingProvider
Public NotInheritable Class CodePagesEncodingProvider
Inherits EncodingProvider
Inheritance
CodePagesEncodingProvider
Inheritance
CodePagesEncodingProvider
Attributes

Remarks

The .NET Framework for the Windows desktop supports a large set of Unicode and code page encodings. .NET Core, on the other hand, supports only the following encodings:

  • ASCII (code page 20127), which is returned by the Encoding.ASCII property.

  • ISO-8859-1 (code page 28591).

  • UTF-7 (code page 65000), which is returned by the Encoding.UTF7 property.

  • UTF-8 (code page 65001), which is returned by the Encoding.UTF8 property.

  • UTF-16 and UTF-16LE (code page 1200), which is returned by the Encoding.Unicode property.

  • UTF-16BE (code page 1201), which is instantiated by calling the UnicodeEncoding.UnicodeEncoding or UnicodeEncoding.UnicodeEncoding constructor with a bigEndian value of true.

  • UTF-32 and UTF-32LE (code page 12000), which is returned by the Encoding.UTF32 property.

  • 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.

Other than code page 20127, code page encodings are not supported.

The CodePagesEncodingProvider class extends EncodingProvider to make these code pages available to .NET Core. To use these additional code pages, you do the following:

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.

Properties

Instance

Gets an encoding provider for code pages supported in the desktop .NET Framework but not in the current .NET Framework platform.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
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.

(Inherited from EncodingProvider)
GetEncoding(Int32)

Returns the encoding associated with the specified code page identifier.

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.

(Inherited from EncodingProvider)
GetEncoding(String)

Returns the encoding associated with the specified code page name.

GetEncodings()

Returns an array that contains all the encodings that are supported by the CodePagesEncodingProvider.

GetEncodings()

Returns an array that contains all the encodings that are supported by the EncodingProvider.

(Inherited from EncodingProvider)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to