Skip surrogate pairs (e.g. emojis) when making clean stings.
This commit is contained in:
Bjarke Berg
2022-04-29 13:46:19 +02:00
committed by GitHub
parent 1a82e0854a
commit 285c7e75a2
2 changed files with 10 additions and 3 deletions

View File

@@ -345,11 +345,14 @@ namespace Umbraco.Cms.Core.Strings
var isUpper = char.IsUpper(c); // false for digits, symbols...
//var isLower = char.IsLower(c); // false for digits, symbols...
// what should I do with surrogates?
// no idea, really, so they are not supported at the moment
// what should I do with surrogates? - E.g emojis like 🎈
// no idea, really, so they are not supported at the moment and we just continue
var isPair = char.IsSurrogate(c);
if (isPair)
throw new NotSupportedException("Surrogate pairs are not supported.");
{
continue;
}
switch (state)
{