utf8cpp

C++ library for UTF-8 string handling and validation

brewmacoslinux
Try with needOr install directly
Source

About

UTF-8 with C++ in a Portable Way

Commands

utf8cpp

Examples

Include utf8cpp headers in C++ project for UTF-8 validation$ #include <utf8.h> // Use utf8::is_valid() to check UTF-8 string validity
Validate UTF-8 encoded string in C++ code$ std::string str = "Hello UTF-8: café"; if (utf8::is_valid(str.begin(), str.end())) { /* valid */ }
Iterate over UTF-8 codepoints in a string$ std::string utf8_string = "Hello 世界"; for (auto it = utf8_string.begin(); it != utf8_string.end(); utf8::next(it, utf8_string.end())) { /* process codepoint */ }