Skip to content
Snippets Groups Projects
Commit 08dc0d4d authored by George Nachman's avatar George Nachman
Browse files

Fix bug where a surrogate pair at the end of a line would get cut in half when...

Fix bug where a surrogate pair at the end of a line would get cut in half when copying because rangeOfCharacterFromSet:options: can return a length greater than 1. Issue 3544. See also commit 8fb8a564 in the v2 branch
parent c608c37e
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -1242,9 +1242,9 @@ static TECObjectRef CreateTECConverterForUTF8Variants(TextEncodingVariant varian
options:NSBackwardsSearch];
if (rangeOfLastWantedCharacter.location == NSNotFound) {
[self deleteCharactersInRange:NSMakeRange(0, self.length)];
} else if (rangeOfLastWantedCharacter.location < self.length - 1) {
NSUInteger i = rangeOfLastWantedCharacter.location + 1;
[self deleteCharactersInRange:NSMakeRange(i, self.length - i)];
} else if (NSMaxRange(rangeOfLastWantedCharacter) < self.length) {
[self deleteCharactersInRange:NSMakeRange(NSMaxRange(rangeOfLastWantedCharacter),
self.length - NSMaxRange(rangeOfLastWantedCharacter))];
}
}
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment