From be1dc86b5434e84a88ba2e62873d87c62f8880c0 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 6 Aug 2017 22:07:03 +0200 Subject: Add utf module Currently only has valid_utf8 and read_utf8 --- src/utf.hh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/utf.hh (limited to 'src/utf.hh') diff --git a/src/utf.hh b/src/utf.hh new file mode 100644 index 0000000..7625b1b --- /dev/null +++ b/src/utf.hh @@ -0,0 +1,14 @@ +// -*- mode: c++; c-basic-offset: 2; -*- + +#ifndef UTF_HH +#define UTF_HH + +#include + +char* read_utf8(char const* in, size_t max, uint32_t* out); + +bool valid_utf8(std::string const& str, size_t start = 0, + size_t len = std::string::npos); +bool valid_utf8(char const* str, size_t len = std::string::npos); + +#endif // UTF_HH -- cgit v1.2.3-70-g09d2