From c4c875b860d9a447967b625f67748e962b697652 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 23 Feb 2015 10:10:54 +1100 Subject: Fix non-BMP character entry through the inline IME. --- src/UniConversion.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/UniConversion.h') diff --git a/src/UniConversion.h b/src/UniConversion.h index 8c7ac4a27..08898cac3 100644 --- a/src/UniConversion.h +++ b/src/UniConversion.h @@ -55,6 +55,12 @@ inline bool UTF8IsNEL(const unsigned char *us) { return (us[0] == 0xc2) && (us[1] == 0x85); } +enum { SURROGATE_LEAD_FIRST = 0xD800 }; +enum { SURROGATE_LEAD_LAST = 0xDBFF }; +inline unsigned int UTF16CharLength(wchar_t uch) { + return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; +} + #ifdef SCI_NAMESPACE } #endif -- cgit v1.2.3