Skip to content

Commit f2f30c2

Browse files
authored
Merge pull request #2602 from corob-msft/cr-1826
Update _mbclen, _ismbblead for issue 1826
2 parents 29edbe6 + edc99fc commit f2f30c2

2 files changed

Lines changed: 34 additions & 22 deletions

File tree

docs/c-runtime-library/reference/ismbblead-ismbblead-l.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "_ismbblead, _ismbblead_l"
3-
ms.date: "11/04/2016"
3+
description: "Describes the Microsoft C Runtime Library (CRT) _ismbblead and _ismbblead_l functions."
4+
ms.date: "01/08/2020"
45
api_name: ["_ismbblead_l", "_ismbblead"]
56
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-multibyte-l1-1-0.dll"]
67
api_type: ["DLLExport"]
@@ -11,7 +12,7 @@ ms.assetid: 2abc6f75-ed5c-472e-bfd0-e905a1835ccf
1112
---
1213
# _ismbblead, _ismbblead_l
1314

14-
Tests a character to determine whether it is a lead byte of a multibyte character.
15+
Tests a character to determine whether it's a lead byte of a multibyte character.
1516

1617
## Syntax
1718

@@ -27,13 +28,13 @@ int _ismbblead_l(
2728

2829
### Parameters
2930

30-
*c*<br/>
31+
*c*\
3132
Integer to be tested.
3233

33-
*locale*<br/>
34+
*locale*\
3435
Locale to use.
3536

36-
## Return Value
37+
## Return value
3738

3839
Returns a nonzero value if the integer *c* is the first byte of a multibyte character.
3940

@@ -43,7 +44,11 @@ Multibyte characters consist of a lead byte followed by a trailing byte. Lead by
4344

4445
**_ismbblead** uses the current locale for locale-dependent behavior. **_ismbblead_l** is identical except that it uses the locale passed in instead. For more information, see [Locale](../../c-runtime-library/locale.md).
4546

46-
### Generic-Text Routine Mappings
47+
When the locale is UTF-8, **_ismbblead** and **_ismbblead_l** always return 0 (false), whether *c* is a lead byte or not.
48+
49+
**_ismbblead** and **_ismbblead_l** are Microsoft-specific, not part of the Standard C library. We don't recommend you use them where you want portable code. For Standard C compatibility, use **mbrlen** instead.
50+
51+
### Generic-text routine mappings
4752

4853
|Tchar.h routine|_UNICODE and _MBCS not defined|_MBCS defined|_UNICODE defined|
4954
|---------------------|--------------------------------------|--------------------|-----------------------|
@@ -62,5 +67,6 @@ For more compatibility information, see [Compatibility](../../c-runtime-library/
6267

6368
## See also
6469

65-
[Byte Classification](../../c-runtime-library/byte-classification.md)<br/>
66-
[_ismbb Routines](../../c-runtime-library/ismbb-routines.md)<br/>
70+
[Byte classification](../../c-runtime-library/byte-classification.md)\
71+
[_ismbb routines](../../c-runtime-library/ismbb-routines.md)\
72+
[mbrlen](mbrlen.md)

docs/c-runtime-library/reference/mbclen-mblen-mblen-l.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
title: "_mbclen, mblen, _mblen_l, _mbclen_l"
3-
ms.date: "01/22/2019"
3+
description: "Describes the Microsoft C Runtime Library (CRT) _mbclen, mblen, _mblen_l, and _mbclen_l functions."
4+
ms.date: "01/08/2020"
45
api_name: ["_mbclen", "mblen", "_mblen_l", "_mbclen_l"]
56
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll", "api-ms-win-crt-multibyte-l1-1-0.dll", "api-ms-win-crt-string-l1-1-0.dll"]
67
api_type: ["DLLExport"]
@@ -39,29 +40,33 @@ int _mblen_l(
3940

4041
### Parameters
4142

42-
*c*<br/>
43+
*c*\
4344
Multibyte character.
4445

45-
*mbstr*<br/>
46+
*mbstr*\
4647
Address of a multibyte-character byte sequence.
4748

48-
*count*<br/>
49+
*count*\
4950
Number of bytes to check.
5051

51-
*locale*<br/>
52+
*locale*\
5253
Locale to use.
5354

5455
## Return Value
5556

56-
**_mbclen** returns 1 or 2, according to whether the multibyte character *c* is 1 or 2 bytes long. There is no error return for **_mbclen**. If *mbstr* isn't **NULL**, **mblen** returns the length, in bytes, of the multibyte character. If *mbstr* is **NULL** or it points to the wide-character null character, **mblen** returns 0. When the object that *mbstr* points to doesn't form a valid multibyte character within the first *count* characters, **mblen** returns -1.
57+
**_mbclen** and **_mbclen_l** return 1 or 2, according to the length of the multibyte character *c*. The functions always return 1 for UTF-8, whether *c* is multibyte or not. There's no error return for **_mbclen**.
58+
59+
If *mbstr* isn't **NULL**, **mblen** and **_mblen_l** return the length, in bytes, of the multibyte character. The **mblen** and **_mblen_l** functions work correctly on UTF-8, and may return a value between 1 and 3. When *mbstr* is **NULL** (or it points to the wide-character null character), **mblen** and **_mblen_l** return 0. The object that *mbstr* points to must form a valid multibyte character within the first *count* characters, or **mblen** and **_mblen_l** return -1.
5760

5861
## Remarks
5962

60-
The **_mbclen** function returns the length, in bytes, of the multibyte character *c*. If *c* doesn't point to the lead byte of a multibyte character as determined by an implicit call to **_ismbblead**, the result of **_mbclen** is unpredictable.
63+
The **_mbclen** function returns the length, in bytes, of the multibyte character *c*. If *c* doesn't point to the lead byte of a multibyte character (as determined by an implicit call to [_ismbblead](ismbblead-ismbblead-l.md), the result of **_mbclen** is unpredictable.
64+
65+
**mblen** returns the length in bytes of *mbstr* if it's a valid multibyte character. It also determines multibyte-character validity associated with the code page. **mblen** examines *count* or fewer bytes contained in *mbstr*, but not more than **MB_CUR_MAX** bytes.
6166

62-
**mblen** returns the length in bytes of *mbstr* if it's a valid multibyte character and determines multibyte-character validity associated with the code page. **mblen** examines *count* or fewer bytes contained in *mbstr*, but not more than **MB_CUR_MAX** bytes.
67+
The output value is affected by the **LC_CTYPE** category setting of the locale. The versions of these functions without the **_l** suffix use the current locale for this locale-dependent behavior. The **_l** suffixed versions behave the same, but they use the locale parameter passed in instead. For more information, see [setlocale](setlocale-wsetlocale.md) and [Locale](../../c-runtime-library/locale.md).
6368

64-
The output value is affected by the **LC_CTYPE** category setting of the locale; see [setlocale](setlocale-wsetlocale.md) for more information. The versions of these functions without the **_l** suffix use the current locale for this locale-dependent behavior. The **_l** suffixed versions behave the same, but they use the locale parameter passed in instead. For more information, see [Locale](../../c-runtime-library/locale.md).
69+
**_mbclen**, **_mblen_l**, and **_mbclen_l** are Microsoft-specific, not part of the Standard C library. We don't recommend you use them where you want portable code. For Standard C compatibility, use **mblen** or **mbrlen** instead.
6570

6671
### Generic-Text Routine Mappings
6772

@@ -120,8 +125,9 @@ Length in bytes of NULL multibyte character 0: 0
120125

121126
## See also
122127

123-
[Character Classification](../../c-runtime-library/character-classification.md)<br/>
124-
[Locale](../../c-runtime-library/locale.md)<br/>
125-
[Interpretation of Multibyte-Character Sequences](../../c-runtime-library/interpretation-of-multibyte-character-sequences.md)<br/>
126-
[_mbccpy, _mbccpy_l](mbccpy-mbccpy-l.md)<br/>
127-
[strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l](strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l.md)<br/>
128+
[Character Classification](../../c-runtime-library/character-classification.md)\
129+
[Locale](../../c-runtime-library/locale.md)\
130+
[Interpretation of Multibyte-Character Sequences](../../c-runtime-library/interpretation-of-multibyte-character-sequences.md)\
131+
[_mbccpy, _mbccpy_l](mbccpy-mbccpy-l.md)\
132+
[mbrlen](mbrlen.md)\
133+
[strlen, wcslen, _mbslen, _mbslen_l, _mbstrlen, _mbstrlen_l](strlen-wcslen-mbslen-mbslen-l-mbstrlen-mbstrlen-l.md)

0 commit comments

Comments
 (0)