Visual Basic Concepts

Issues Specific to the Double-Byte Character Set (DBCS)

The double-byte character set (DBCS) was created to handle East Asian languages that use ideographic characters, which require more than the 256 characters supported by ANSI. Characters in DBCS are addressed using a 16-bit notation, using 2 bytes. With 16-bit notation you can represent 65,536 characters, although far fewer characters are defined for the East Asian languages. For instance, Japanese character sets today define about 12,000 characters.

In locales where DBCS is used — including China, Japan, and Korea — both single-byte and double-byte characters are included in the character set. The single-byte characters used in these locales conform to the 8-bit national standards for each country and correspond closely to the ASCII character set. Certain ranges of codes in these single-byte character sets (SBCS) are designated as lead bytes for DBCS characters. A consecutive pair made of a lead byte and a trail byte represents one double-byte character. The code range used for the lead byte depends on the locale.

Note   DBCS is a different character set from Unicode. Because Visual Basic represents all strings internally in Unicode format, both ANSI characters and DBCS characters are converted to Unicode and Unicode characters are converted to ANSI characters or DBCS characters automatically whenever the conversion is needed. You can also convert between Unicode and ANSI/DBCS characters manually. For more information about conversion between different character sets, see "DBCS String Manipulation Functions."

When developing a DBCS-enabled application with Visual Basic, you should consider:

  • Differences between Unicode, ANSI, and DBCS.

  • DBCS sort orders and string comparison.

  • DBCS string manipulation functions.

  • DBCS string conversion.

  • How to display and print fonts correctly in a DBCS environment.

  • How to process files that include double-byte characters.

  • DBCS identifiers.

  • DBCS-enabled events.

  • How to call Windows APIs.

Tip   Developing a DBCS-enabled application is good practice, whether or not the application is run in a locale where DBCS is used. This approach will help you develop a flexible, portable, and truly international application. None of the DBCS-enabling features in Visual Basic will interfere with the behavior of your application in environments using exclusively single-byte character sets (SBCS), and the size of your application will not increase because both DBCS and SBCS use Unicode internally.

For More Information   For limitations on using DBCS for access and shortcut keys, see "Designing an International-Aware User Interface."