File Encodings
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

File Encodings 

File encodings, also known as character encodings, specify how to represent characters when text processing. One encoding may be preferable over another in terms of which language characters it can or cannot handle, although Unicode is usually preferred.

When reading from or writing to files, improperly matching file encodings may result in exceptions or incorrect results.

Types of Encodings

Unicode is the preferred encoding when working with files. Unicode is a worldwide character-encoding standard that uses 16-bit code values to represent all the characters used in modern computing, including technical symbols and special characters used in publishing.

Previous character-encoding standards consisted of traditional character sets, such as the Windows ANSI character set that uses 8-bit code values, or combinations of 8-bit values, to represent the characters used in a specific language or geographical region.

Encoding Class

The Encoding class represents a character encoding. This table lists the type of encodings available and describes each.

Name Description


Represents an ASCII character encoding of Unicode characters.


Represents a UTF-16 encoding of Unicode characters.


Represents a UTF-32 encoding of Unicode characters.


Represents a UTF-7 encoding of Unicode characters.


Represents a UTF-8 encoding of Unicode characters.

See Also

© 2015 Microsoft