Skip to content

Commit 979e0b6

Browse files
Merge pull request MicrosoftDocs#5518 from ychikazawa/patch-1
Clarified MBCS support in unicode-and-multibyte-character-set-mbcs-support.md
2 parents e14964e + 9346de6 commit 979e0b6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/atl-mfc-shared/unicode-and-multibyte-character-set-mbcs-support.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ helpviewer_keywords: ["MFC [C++], character set support", "MBCS [C++], strings a
88

99
Some languages, for example, Japanese and Chinese, have large character sets. To support programming for these markets, the Microsoft Foundation Class Library (MFC) enables two different approaches to handling large character sets:
1010

11-
- [Unicode](#mfc-support-for-unicode-strings), **`wchar_t`** based wide-characters and strings encoded as UTF-16.
11+
- [Unicode](#mfc-support-for-unicode-strings), **`wchar_t`** based wide-characters, and strings encoded as UTF-16.
1212

1313
- [Multibyte Character Sets (MBCS)](#mfc-support-for-mbcs-strings), **`char`** based single or double-byte characters and strings encoded in a locale-specific character set.
1414

15-
Microsoft has recommended the MFC Unicode libraries for all new development, and the MBCS libraries were deprecated in Visual Studio 2013 and Visual Studio 2015. This is no longer the case. The MBCS deprecation warnings have been removed in Visual Studio 2017.
15+
> [!NOTE]
16+
> Microsoft recommends the MFC Unicode libraries for all new development.\
17+
> The MBCS libraries were deprecated in Visual Studio 2013 and Visual Studio 2015. This is no longer the case.\
18+
> Starting with Visual Studio 2017, the MBCS libraries are no longer deprecated and don't generate deprecation warnings.
1619
1720
## MFC Support for Unicode Strings
1821

@@ -51,13 +54,13 @@ These library, debugger, and DLL files are used to support Unicode in MFC:
5154

5255
(*version* represents the version number of the file; for example, '140' means version 14.0.)
5356

54-
`CString` is based on the `TCHAR` data type. If the symbol `_UNICODE` is defined for a build of your program, `TCHAR` is defined as type **`wchar_t`**, a 16-bit character encoding type. Otherwise, `TCHAR` is defined as **`char`**, the normal 8-bit character encoding. Therefore, under Unicode, a `CString` is composed of 16-bit characters. Without Unicode, it is composed of characters of type **`char`**.
57+
`CString` is based on the `TCHAR` data type. If the symbol `_UNICODE` is defined for a build of your program, `TCHAR` is defined as type **`wchar_t`**, a 16-bit character encoding type. Otherwise, `TCHAR` is defined as **`char`**, the normal 8-bit character encoding. Therefore, under Unicode, a `CString` is composed of 16-bit characters. Without Unicode, it's composed of characters of type **`char`**.
5558

5659
To complete Unicode programming of your application, you must also:
5760

5861
- Use the `_T` macro to conditionally code literal strings to be portable to Unicode.
5962

60-
- When you pass strings, pay attention to whether function arguments require a length in characters or a length in bytes. The difference is important if you are using Unicode strings.
63+
- When you pass strings, pay attention to whether function arguments require a length in characters or a length in bytes. The difference is important if you're using Unicode strings.
6164

6265
- Use portable versions of the C run-time string-handling functions.
6366

@@ -77,9 +80,9 @@ The [Run-Time Library Reference](../c-runtime-library/c-run-time-library-referen
7780

7881
The class library is also enabled for multibyte character sets, but only for double-byte character sets (DBCS).
7982

80-
In a multibyte character set, a character can be one or two bytes wide. If it is two bytes wide, its first byte is a special "lead byte" that is chosen from a particular range, depending on which code page is in use. Taken together, the lead and "trail bytes" specify a unique character encoding.
83+
In a multibyte character set, a character can be one or 2 bytes wide. If it's 2 bytes wide, its first byte is a special "lead byte" that is chosen from a particular range, depending on which code page is in use. Taken together, the lead and "trail bytes" specify a unique character encoding.
8184

82-
If the symbol `_MBCS` is defined for a build of your program, type `TCHAR`, on which `CString` is based, maps to **`char`**. It is up to you to determine which bytes in a `CString` are lead bytes and which are trail bytes. The C run-time library supplies functions to help you determine this.
85+
If the symbol `_MBCS` is defined for a build of your program, type `TCHAR`, on which `CString` is based, maps to **`char`**. It's up to you to determine which bytes in a `CString` are lead bytes and which are trail bytes. The C run-time library supplies functions to help you determine this.
8386

8487
Under DBCS, a given string can contain all single-byte ANSI characters, all double-byte characters, or a combination of the two. These possibilities require special care in parsing strings. This includes `CString` objects.
8588

0 commit comments

Comments
 (0)