public asciify

This commit is contained in:
2026-05-27 09:58:19 -03:00
parent 74a5ef63b0
commit 902e29dc93
2 changed files with 16 additions and 3 deletions

View File

@@ -92,4 +92,18 @@ int fequal(float a, float b, float delta);
* be NUL-terminated. */
void trim(char *s);
/* Transliterate accented Latin chars to plain ASCII. Walks src as UTF-8,
* mapping known accented chars (a-acute, c-cedilla, n-tilde, NBSP, ...)
* to their ASCII equivalents and copying ASCII bytes verbatim. Output is
* always pure ASCII and NUL-terminated. Bytes that don't match the
* transliteration table are skipped.
*
* Parameters:
* src input UTF-8 string (NUL-terminated)
* dest output buffer (filled with NUL-terminated ASCII)
* dest_size size of dest in bytes (writes capped at dest_size-1 + final NUL)
*
* Safe for NULL / zero-size args (no-op). */
void asciify(const char *src, char *dest, size_t dest_size);
#endif /* LIB11SHT_H */