diff options
Diffstat (limited to 'base/utf_string_conversion_utils.h')
-rw-r--r-- | base/utf_string_conversion_utils.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/base/utf_string_conversion_utils.h b/base/utf_string_conversion_utils.h index a8a76c5..3fcb689 100644 --- a/base/utf_string_conversion_utils.h +++ b/base/utf_string_conversion_utils.h @@ -12,11 +12,12 @@ namespace base { inline bool IsValidCodepoint(uint32 code_point) { - // Excludes the surrogate code points ([0xD800, 0xDFFF]) and - // codepoints larger than 0x10FFFF (the highest codepoint allowed). - // Non-characters and unassigned codepoints are allowed. - return code_point < 0xD800u || - (code_point >= 0xE000u && code_point <= 0x10FFFFu); + // Excludes non-characters (U+FDD0..U+FDEF, and all codepoints ending in + // 0xFFFE or 0xFFFF), surrogate code points (U+D800..U+DFFF), and codepoints + // larger than U+10FFFF (the highest codepoint allowed). + return code_point < 0xD800u || (code_point >= 0xE000u && + code_point < 0xFDD0u) || (code_point > 0xFDEFu && + code_point <= 0x10FFFFu && (code_point & 0xFFFEu) != 0xFFFEu); } // ReadUnicodeCharacter -------------------------------------------------------- |