#ifndef PMS_UTIL_H #define PMS_UTIL_H #include /* * Fold a UTF-8 string to lowercase ASCII (stripping Portuguese diacritics). * Writes at most dst_size - 1 characters + NUL to dst. * If byte_map is non-NULL (must have at least dst_size ints), byte_map[i] * stores the byte offset in `src` corresponding to `dst[i]`, and * byte_map[folded_len] stores strlen(src). * Returns the length of the folded string in `dst`. */ size_t pms_fold_utf8(const char *src, char *dst, size_t dst_size, int *byte_map); /* * Normalize a book name/abbreviation query into lowercase alphanumeric ASCII * (stripping spaces, dots, hyphens, parentheses, and accents). */ size_t pms_normalize_book_key(const char *src, char *dst, size_t dst_size); /* * Count display columns (UTF-8 codepoints) in a NUL-terminated string or slice. */ size_t pms_utf8_char_len(const char *s, size_t byte_len); #endif /* PMS_UTIL_H */