1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
10 .\" References consulted:
11 .\" GNU glibc-2 source code and manual
12 .\" Dinkumware C library reference http://www.dinkumware.com/
13 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
16 .TH MBLEN 3 2021-03-22 "GNU" "Linux Programmer's Manual"
18 mblen \- determine number of bytes in next multibyte character
21 .B #include <stdlib.h>
23 .BI "int mblen(const char *" s ", size_t " n );
30 function inspects at most
32 bytes of the multibyte string starting at
35 next complete multibyte character.
36 It uses a static anonymous shift state known only to the
39 If the multibyte character is not the null wide
40 character, it returns the number of bytes that were consumed from
42 If the multibyte character is the null wide character, it returns 0.
48 do not contain a complete multibyte
52 This can happen even if
54 is greater than or equal to
56 if the multibyte string contains redundant shift sequences.
58 If the multibyte string starting at
60 contains an invalid multibyte
61 sequence before the next complete character,
70 .\" The Dinkumware doc and the Single UNIX specification say this, but
71 .\" glibc doesn't implement this.
72 resets the shift state, known to only this function, to the initial state, and
73 returns nonzero if the encoding has nontrivial shift state, or zero if the
74 encoding is stateless.
78 function returns the number of
79 bytes parsed from the multibyte
82 if a non-null wide character was recognized.
83 It returns 0, if a null wide character was recognized.
85 invalid multibyte sequence was encountered or if it couldn't parse a complete
88 For an explanation of the terms used in this section, see
96 Interface Attribute Value
99 T} Thread safety MT-Unsafe race
105 POSIX.1-2001, POSIX.1-2008, C99.
116 provides a better interface to the same