diff options
author | Roland Reichwein <mail@reichwein.it> | 2021-01-28 21:18:39 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2021-01-28 21:18:39 +0100 |
commit | ae0ccdf4569d6d4f49c60392a9e849aaa58c3fa6 (patch) | |
tree | 42f8f4a3a62edff2d2d851f688d6a6cae26c7ae2 /include | |
parent | cd4fad54c0be9fb7fca57e8e03228b8b649b5b51 (diff) |
Bugfix, test
Diffstat (limited to 'include')
-rw-r--r-- | include/unicode.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/unicode.h b/include/unicode.h index f539e6b..908c75f 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -141,6 +141,11 @@ namespace { throw std::invalid_argument("Bad input: Invalid 2 byte sequence"); } else throw std::invalid_argument("Bad input: 2nd byte expected, none found"); + + // check only for sequences >= 2 bytes (ASCII is always compliant) + if (!unicode::is_valid_unicode(value)) + throw std::invalid_argument("Invalid Unicode character: "s + std::to_string(static_cast<uint32_t>(value))); + } else { // 1 byte: 7 bit ASCII value = byte0; sequence_length = 1; |