From da11495282000e196384a735fe63b82817a7f8ed Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Fri, 27 Sep 2024 14:09:05 +0200 Subject: [PATCH] string: fix high&low UTF-16 surrogate detection U+D800 is a perfectly valid high surrogate. (Thou, not normal.) While U+DC00 is a perfectly valid low surrogate. --- include/stdex/string.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index 6e04cbc89..3d6956c7f 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -1,4 +1,4 @@ -/* +/* SPDX-License-Identifier: MIT Copyright © 2016-2024 Amebis */ @@ -42,7 +42,7 @@ namespace stdex /// inline bool is_high_surrogate(_In_ utf16_t chr) { - return 0xd800 < chr && chr < 0xdc00; + return 0xd800 <= chr && chr < 0xdc00; } /// @@ -52,7 +52,7 @@ namespace stdex /// inline bool is_low_surrogate(_In_ utf16_t chr) { - return 0xdc00 < chr && chr < 0xe000; + return 0xdc00 <= chr && chr < 0xe000; } ///