summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/unicode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/unicode.cpp')
-rw-r--r--src/lib/util/unicode.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lib/util/unicode.cpp b/src/lib/util/unicode.cpp
index 535207e2431..4613fa76350 100644
--- a/src/lib/util/unicode.cpp
+++ b/src/lib/util/unicode.cpp
@@ -23,6 +23,33 @@ bool uchar_isvalid(unicode_char uchar)
//-------------------------------------------------
+// uchar_is_printable - tests to see if a unicode
+// char is printable
+//-------------------------------------------------
+
+bool uchar_is_printable(unicode_char uchar)
+{
+ return
+ !(0x0001f >= uchar) && // C0 control
+ !((0x0007f <= uchar) && (0x0009f >= uchar)) && // DEL and C1 control
+ !((0x0fdd0 <= uchar) && (0x0fddf >= uchar)) && // noncharacters
+ !(0x0fffe == (uchar & 0x0ffff)) && // byte-order detection noncharacter
+ !(0x0ffff == (uchar & 0x0ffff)); // the other noncharacter
+}
+
+
+//-------------------------------------------------
+// uchar_is_digit - tests to see if a unicode
+// char is a digit
+//-------------------------------------------------
+
+bool uchar_is_digit(unicode_char uchar)
+{
+ return uchar >= '0' && uchar <= '9';
+}
+
+
+//-------------------------------------------------
// uchar_from_utf8 - convert a UTF-8 sequence
// into a unicode character
//-----------------------------------------------