1fmt_utf8(3) Library Functions Manual fmt_utf8(3)
2
3
4
6 fmt_utf8 - encode 31-bit unsigned integer using UTF-8 rules
7
9 #include <fmt.h>
10
11 size_t fmt_utf8(char *dest,uint32_t source);
12
14 fmt_utf8 encodes a 31-bit unsigned integer using the UTF-8 rules. This
15 can take from 1 byte (0-0x7f) up to 5 bytes (0x4000000-0x7fffffff).
16 Values larger than 0x7fffffff cannot be represented in this encoding.
17
18 If dest equals FMT_LEN (i.e. is NULL), fmt_utf8 returns the number of
19 bytes it would have written.
20
21 For convenience, fmt.h defines the integer FMT_UTF8 to be big enough to
22 contain every possible fmt_utf8 output.
23
25 fmt_utf8 and scan_utf8 implement the encoding from UTF-8, but are meant
26 to be able to store integers, not just Unicode code points. Values
27 larger than 0x10ffff are not valid UTF-8 (see RFC 3629) but can be rep‐
28 resented in the encoding, so fmt_utf8 will allow them.
29
31 scan_utf8(3)
32
33
34
35 fmt_utf8(3)