aboutsummaryrefslogtreecommitdiff
path: root/include/mgl/system/utf8.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mgl/system/utf8.h')
-rw-r--r--include/mgl/system/utf8.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/mgl/system/utf8.h b/include/mgl/system/utf8.h
new file mode 100644
index 0000000..663e7e3
--- /dev/null
+++ b/include/mgl/system/utf8.h
@@ -0,0 +1,17 @@
+#ifndef MGL_UTF8_H
+#define MGL_UTF8_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+bool mgl_utf8_is_valid(const unsigned char *str, size_t size);
+
+/*
+ Returns the byte length of the decoded codepoint.
+ Note: does not validate if the input |str| is a valid utf8 string.
+*/
+size_t mgl_utf8_decode(const unsigned char *str, uint32_t *decoded_codepoint);
+
+#endif /* MGL_UTF8_H */
+