utf.h 1.2 KB

1234567891011121314151617181920212223242526
  1. #pragma once
  2. #include "foundation/types.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /* to utf8 */
  7. size_t utf16LE_to_utf8(const uint16_t *src, size_t source_len, char *dst, size_t out_len);
  8. size_t utf16BE_to_utf8(const uint16_t *src, size_t source_len, char *dst, size_t out_len);
  9. size_t ISO_8859_1_to_utf8(const char *src, size_t source_len, char *dst, size_t out_len);
  10. size_t ASCII_to_utf8(const char *src, size_t source_len, char *dst, size_t out_len);
  11. size_t ucs4_to_utf8(const uint32_t *src, size_t source_len, char *dst, size_t out_len);
  12. /* from utf8 */
  13. size_t utf8_to_utf16LE(const char *src, size_t source_len, uint16_t *dst, size_t out_len);
  14. size_t utf8_to_ISO_8859_1(const char *src, size_t source_len, char *dst, size_t out_len);
  15. size_t utf8_to_utf16BE(const char *src, size_t source_len, uint16_t *dst, size_t out_len);
  16. size_t utf8_to_ASCII(const char *src, size_t source_len, char *dst, size_t out_len);
  17. size_t utf8_to_ucs4(const char *src, size_t source_len, uint32_t *dst, size_t out_len);
  18. /* returns the number of bytes required to make the specified number of codepoints exactly fit */
  19. size_t utf8_strnlen(const char *src, size_t source_len, size_t codepoints);
  20. #ifdef __cplusplus
  21. }
  22. #endif