The difference between character strings in UNICODE and MBCS encoding is unicodembcs.

Source: Internet
Author: User

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

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.