Converting Existing Encodings






Converting Existing Encodings

Many different schemes have been developed for representing the characters in a language as numeric codes within a computer. These schemes are referred to as encodings. The .NET Framework provides support for encodings through the System.Text.Encoding class.

Internally, preferred encoding for characters is 16-bit Unicode, commonly known as UTF-16. This encoding represents characters as 16-bit numbers, giving the .NET Framework the capability to represent approximately 65,000 distinct characters.

The System.Text namespace contains classes designed to let you convert characters from the UTF-16 Unicode encoding to other encodings, and vice versa. You might need to use these classes for compatibility or communication with older applications. Figure lists these classes.

Figure Encoding Classes in the System.Text Namespace

Class

Use

ASCIIEncoding

Converts characters between Unicode and ASCII.

Encoding

Functions as a general-purpose class. The Encoding.GetEncoding() static method returns encodings that can be used for legacy code page compatibility.

UnicodeEncoding

Converts characters to and from Unicode-encoded text as consecutive bytes in either big-endian or little-endian order.

UTF7Encoding

Converts characters to and from 7-bit Unicode encoding.

UTF8Encoding

Converts characters to and from 8-bit Unicode encoding.


     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows