The VB6/VBA StrConv Function
Using StrConv with ANSI, DBCS and Unicode character sets.
DBCS, ANSI and Unicode Characters
The VB6 functions [i.e. Len, Asc, Chr, InStr, etc.] without a "B" or "W" correctly handle DBCS and ANSI characters. In addition to the functions above, the String function handles DBCS characters. This means that all these functions consider a DBCS character as one character even if that character consists of 2 bytes.
The behavior of these functions is different when they're handling SBCS and DBCS characters. For instance, the Mid function is used in Visual Basic to return a specified number of characters from a string. In locales using DBCS, the number of characters and the number of bytes are not necessarily the same. Mid would only return the number of characters, not bytes.
StrConv Function
The global options of the StrConv function are converting uppercase to lowercase, and vice versa. In addition to those options, the function has several DBCS-specific options. For example, you can convert narrow letters to wide letters by specifying vbWide in the second argument of this function. You can convert one character type to another, such as hiragana to katakana in Japanese. StrConv enables you to specify a LocaleID for the string, if different than the system's LocaleID.
You can also use the StrConv function to convert Unicode characters to ANSI/DBCS characters, and vice versa. VB6 and VBA store strings internally encoded as "Unicode" (more accurately, UTF-16) characters.
Source: Apparently from somewhere in the Microsoft Knowledge Base. Thanks to Robert Garofalo for this info.
See also How to convert VBA/VB6 Unicode strings to UTF-8.
This page last updated 15 August 2018.
Return to DI Management's Cryptography Code Page.