System.Text.UTF7Encoding Class

Represents a UTF-7 encoding of Unicode characters.

See Also: UTF7Encoding Members

Syntax

[System.Runtime.InteropServices.ComVisible(true)]
public class UTF7Encoding : Encoding

Remarks

Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. Decoding is the process of transforming a sequence of encoded bytes into a set of Unicode characters.

The UTF-7 encoding represents Unicode characters as sequences of 7-bit ASCII characters. This encoding supports certain protocols for which it is required, most often e-mail or newsgroup protocols. Since UTF-7 is not particularly secure or robust, and most modern systems allow 8-bit encodings, UTF-8 should normally be preferred to UTF-7.

Note:

System.Text.UTF7Encoding does not provide error detection. For security reasons, the application should use System.Text.UTF8Encoding, System.Text.UnicodeEncoding, or System.Text.UTF32Encoding and enable error detection.

For more information about the UTFs and other encodings supported by System.Text, see Understanding Encodings.

The UTF7Encoding.GetByteCount(Char[], int, int) method determines how many bytes result in encoding a set of Unicode characters, and the UTF7Encoding.GetBytes(string, int, int, Byte[], int) method performs the actual encoding.

Likewise, the UTF7Encoding.GetCharCount(Byte[], int, int) method determines how many characters result in decoding a sequence of bytes, and the UTF7Encoding.GetChars(Byte[], int, int, Char[], int) and UTF7Encoding.GetString(Byte[], int, int) methods perform the actual decoding.

System.Text.UTF7Encoding corresponds to the Windows code page 65000.

Note:

The state of a UTF-7 encoded object is not preserved if the object is serialized and deserialized using different .NET Framework versions.

Requirements

Namespace: System.Text
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0