ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
utf8.c File Reference

🔤 UTF-8 encoding and decoding with multi-byte character support More...

Go to the source code of this file.

Functions

int utf8_decode (const uint8_t *s, uint32_t *codepoint)
 Decode a UTF-8 sequence to a Unicode codepoint.
 
int utf8_display_width (const char *str)
 Calculate terminal display width of a UTF-8 string.
 
int utf8_display_width_n (const char *str, size_t max_bytes)
 Calculate terminal display width of a UTF-8 string up to byte limit.
 
size_t utf8_char_count (const char *str)
 Count UTF-8 characters (not bytes)
 
bool utf8_is_valid (const char *str)
 Check if a string is valid UTF-8.
 
bool utf8_is_ascii_only (const char *str)
 Check if a string contains only ASCII characters.
 
size_t utf8_to_codepoints (const char *str, uint32_t *out_codepoints, size_t max_codepoints)
 Convert UTF-8 string to array of Unicode codepoints.
 
int utf8_next_char_bytes (const char *str, size_t max_bytes)
 Get byte length of next UTF-8 character.
 
int utf8_continuation_bytes_needed (unsigned char first_byte)
 Determine how many additional bytes are needed to complete a UTF-8 character.
 
int utf8_read_and_insert_continuation_bytes (char *buffer, size_t *cursor, size_t *len, size_t max_len, int continuation_bytes, int(*read_byte_fn)(void))
 Read continuation bytes and insert them into buffer at cursor position.
 
const char * utf8_strcasestr (const char *haystack, const char *needle)
 Case-insensitive substring search with full Unicode support.
 
void utf8_write_lowercase (FILE *output, const char *text)
 Write UTF-8 string to file with ASCII lowercase conversion.
 

Detailed Description

🔤 UTF-8 encoding and decoding with multi-byte character support

Uses utf8proc Unicode library for accurate character-width computation and UTF-8 handling.

Definition in file utf8.c.