aboutsummaryrefslogtreecommitdiffstats
path: root/libutf8_encode_measure.3
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-10-23 21:09:14 +0200
committerMattias Andrée <m@maandree.se>2026-10-23 21:09:14 +0200
commit9d247dc831569a4db75ec9466d1a988a82dfba29 (patch)
treebaf2b21897788f630cb2001beb4f9e5bed9940a7 /libutf8_encode_measure.3
downloadlibutf8-9d247dc831569a4db75ec9466d1a988a82dfba29.tar.gz
libutf8-9d247dc831569a4db75ec9466d1a988a82dfba29.tar.bz2
libutf8-9d247dc831569a4db75ec9466d1a988a82dfba29.tar.xz
First commitHEAD1.0master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--libutf8_encode_measure.358
1 files changed, 58 insertions, 0 deletions
diff --git a/libutf8_encode_measure.3 b/libutf8_encode_measure.3
new file mode 100644
index 0000000..e88a6a9
--- /dev/null
+++ b/libutf8_encode_measure.3
@@ -0,0 +1,58 @@
+.TH LIBUTF8_ENCODE_MEASURE 3 LIBUTF8
+.SH NAME
+libutf8_encode_measure - Get the number of bytes required to encode a codepoint
+
+.SH SYNOPSIS
+.nf
+#include <libutf8.h>
+
+size_t \fBlibutf8_encode_measure\fP(uint_least32_t \fIcodepoint\fP);
+.fi
+.PP
+Link with
+.IR -lutf8 .
+
+.SH DESCRIPTION
+The
+.BR libutf8_encode_measure ()
+function returns the number of bytes required to encode
+.I codepoint
+as UTF-8. It returns zero if the codepoint cannot be
+represented in 31 bits.
+
+.SH RETURN VALUE
+The
+.BR libutf8_encode_measure ()
+function returns the number of bytes required to encode
+.IR codepoint ,
+or zero if it is unrepresentable.
+This value cannot exceed 6, and does not exceed 4 for
+codepoint less or equal to
+.BR LIBUTF8_ULTIMATE_CODEPOINT (3).
+
+.SH ERRORS
+The
+.BR libutf8_encode_measure ()
+function cannot fail per se, and never sets
+.IR errno ;
+.B EDOM
+is an appropriate value when the function returns zero.
+
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.PP
+.TS
+allbox;
+lb lb lb lb
+l l l l.
+Interface Thread safety Async-signal safety Async-cancel safety
+T{
+.BR libutf8_encode_measure ()
+T} MT-Safe AS-Safe AC-Safe
+.TE
+.sp
+
+.SH SEE ALSO
+.BR libutf8 (7),
+.BR libutf8_encode (3)