1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\" References consulted:
6 .\" GNU glibc-2 source code and manual
7 .\" Dinkumware C library reference http://www.dinkumware.com/
8 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
11 .TH MBLEN 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
13 mblen \- determine number of bytes in next multibyte character
16 .RI ( libc ", " \-lc )
19 .B #include <stdlib.h>
21 .BI "int mblen(const char *" s ", size_t " n );
28 function inspects at most
30 bytes of the multibyte string starting at
33 next complete multibyte character.
34 It uses a static anonymous shift state known only to the
37 If the multibyte character is not the null wide
38 character, it returns the number of bytes that were consumed from
40 If the multibyte character is the null wide character, it returns 0.
46 do not contain a complete multibyte
50 This can happen even if
52 is greater than or equal to
54 if the multibyte string contains redundant shift sequences.
56 If the multibyte string starting at
58 contains an invalid multibyte
59 sequence before the next complete character,
68 .\" The Dinkumware doc and the Single UNIX specification say this, but
69 .\" glibc doesn't implement this.
70 resets the shift state, known to only this function, to the initial state, and
71 returns nonzero if the encoding has nontrivial shift state, or zero if the
72 encoding is stateless.
76 function returns the number of
77 bytes parsed from the multibyte
80 if a non-null wide character was recognized.
81 It returns 0, if a null wide character was recognized.
83 invalid multibyte sequence was encountered or if it couldn't parse a complete
86 For an explanation of the terms used in this section, see
94 Interface Attribute Value
97 T} Thread safety MT-Unsafe race
103 POSIX.1-2001, POSIX.1-2008, C99.
114 provides a better interface to the same