Encoding.RegisterProvider Method (EncodingProvider)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Registers an encoding provider.

Namespace:   System.Text
Assembly:  mscorlib (in mscorlib.dll)

public static void RegisterProvider(
	EncodingProvider provider


Type: System.Text.EncodingProvider

A subclass of EncodingProvider that provides access to additional character encodings.

Exception Condition

provider is null.

The RegisterProvider method allows you to register a class derived from EncodingProvider that makes character encodings available on a platform that does not otherwise support them. Once the encoding provider is registered, the encodings that it supports can be retrieved by calling any Encoding.GetEncoding overload.

.NET Framework 4.6 includes one encoding provider, CodePagesEncodingProvider, that makes the encodings available that are present in the full .NET Framework but are not available in .NET Framework 4.6. By default, .NET Framework 4.6 only supports the Unicode encodings, ASCII, and code page 28591.

If the same encoding provider is used in multiple calls to the RegisterProvider method, only the first method call registers the provider. Subsequent calls are ignored.

If the RegisterProvider method is called to register multiple providers that handle the same encoding, the last registered provider is the used for all encoding and decoding operations. Any previously registered providers are ignored.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.6
Return to top