The difference between character strings in UNICODE and MBCS encoding is unicodembcs.
1: SBCS (single byte character set) single-byte character set. In this encoding format, all characters are represented in one byte. The ASCII code is a single-byte character. 0 indicates the end of a byte.
2: Unicode is a two-byte encoding mode for all characters. Unicode characters are also called wide characters.
3: multi-byte characters set (MBCS) multi-byte character set. In windows, MBCS contains two types of characters: single byte characters and double byte characters ). Because most of the Multi-byte characters used in windows are two bytes long, MBCS is often replaced by DBCS.
MBCS Encoding
1 CString strName1 = _ T ("hello"); 2 int nLen = strName1.GetLength (); // 4 3 4 _ bstr_t bstrName1 = (_ bstr_t) strName1; 5 nLen = bstrName1.length (); // 2 6 7 CString strName2 = _ T ("abcd"); 8 nLen = strName2.GetLength (); // 4 9 10 _ bstr_t bstrName2 = (_ bstr_t) strName2; 11 nLen = bstrName2.length (); // 4
Unicode encoding
1 CString strName1 = _ T ("hello"); 2 int nLen = strName1.GetLength (); // 2 3 4 _ bstr_t bstrName1 = (_ bstr_t) strName1; 5 nLen = bstrName1.length (); // 2 6 7 CString strName2 = _ T ("abcd"); 8 nLen = strName2.GetLength (); // 4 9 10 _ bstr_t bstrName2 = (_ bstr_t) strName2; 11 nLen = bstrName2.length (); // 4