System.Text.Encoding.GetEncodings Method

Returns an array that contains all encodings.


public static EncodingInfo[] GetEncodings ()


An array that contains all encodings.


This method returns a list of supported encodings, uniquely distinguished by code page. For a table that lists the supported encodings, see the System.Text.Encoding class topic.

Encodings 50220 and 50222 are both associated with the name "iso-2022-jp", but they are not identical. Encoding 50220 converts half-width Katakana characters to full-width Katakana characters, whereas encoding 50222 uses a shift-in/shift-out sequence to encode half-width Katakana characters. The display name for encoding 50222 is "Japanese (JIS-Allow 1 byte Kana - SO/SI)" to distinguish it from encoding 50220, which has the display name "Japanese (JIS)".

If your application requests the encoding name "iso-2022-jp", the .NET Framework returns encoding 50220. However, the encoding that is appropriate for your application will depend on the preferred treatment of the half-width Katakana characters.

To get a specific encoding, your application should use the Encoding.GetEncoding(int) method.

Encoding.GetEncodings is sometimes used to present the user with a list of encodings in a File Save as dialog box. However, many non-Unicode encodings are either incomplete and translate many characters to "?", or have subtly different behavior on different platforms. Consider using UTF-8 or UTF-16 as the default.


Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0