forked from KolibriOS/kolibrios
Implemented the `is_valid_utf8_char` procedure to safely validate UTF-8 sequences and return their byte length (1-4, or 0 if invalid). This routine implements strict Unicode compliance checks, including: - Rejection of overlong encodings (e.g., checking 0xC0/0xC1, and strict bounds for 0xE0/0xF0). - Prevention of surrogate half decoding (restricting 0xED bounds). - Enforcement of the maximum Unicode scalar value limit (U+10FFFF). - Safe handling of null-terminators and truncated sequences. This provides a secure foundation for upgrading the codepoint and grapheme counting functions in upcoming commits.