共用方式為


File Encodings (Visual Basic)

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

ASCIIEncoding

Represents an ASCII character encoding of Unicode characters.

UnicodeEncoding

Represents a UTF-16 encoding of Unicode characters.

UTF32Encoding

Represents a UTF-32 encoding of Unicode characters.

UTF7Encoding

Represents a UTF-7 encoding of Unicode characters.

UTF8Encoding

Represents a UTF-8 encoding of Unicode characters.

See Also

Other Resources

Reading from Files in Visual Basic

Writing to Files in Visual Basic