DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
utf8.h File Reference

Strict UTF-8 validation (RFC 3629), one shared copy. More...

#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Functions

bool det_utf8_valid (const uint8_t *s, size_t n)
 True if [s, s+n) is well-formed UTF-8.
 

Detailed Description

Strict UTF-8 validation (RFC 3629), one shared copy.

Several protocols must reject non-UTF-8 input: WebSocket TEXT frames (RFC 6455 8.1, fail with close 1007) and MQTT strings (MQTT 1.5.3). Both use this single validator rather than each rolling its own. Header-only inline, like the other shared primitives - zero link cost when unused.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file utf8.h.

Function Documentation

◆ det_utf8_valid()

bool det_utf8_valid ( const uint8_t *  s,
size_t  n 
)
inline

True if [s, s+n) is well-formed UTF-8.

Rejects overlong encodings, surrogate code points (U+D800..U+DFFF), values above U+10FFFF, bad continuation bytes, and truncated multi-byte sequences.

Definition at line 29 of file utf8.h.