From 9d2664fce0c199a5c50df0a20b1ae85beb747a93 Mon Sep 17 00:00:00 2001 From: iska Date: Sun, 26 Oct 2014 23:43:29 +0100 Subject: [PATCH] Fix regex match range index in Process Double Escaped method --- HTMLKitTests/HTML5LibTest.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HTMLKitTests/HTML5LibTest.m b/HTMLKitTests/HTML5LibTest.m index c6f8124..dd656f8 100644 --- a/HTMLKitTests/HTML5LibTest.m +++ b/HTMLKitTests/HTML5LibTest.m @@ -125,18 +125,18 @@ for(NSTextCheckingResult *match in [matches reverseObjectEnumerator]) { - NSRange hexRange = [match rangeAtIndex:2]; + NSRange hexRange = [match rangeAtIndex:1]; NSString *hexString = [string substringWithRange:hexRange]; NSScanner *scanner = [NSScanner scannerWithString:hexString]; unsigned int codepint; [scanner scanHexInt:&codepint]; NSString *replacement = [NSString stringWithFormat:@"%C", (unichar)codepint]; - NSRange matchRange = [match rangeAtIndex:1]; + NSRange matchRange = [match rangeAtIndex:0]; string = [string stringByReplacingCharactersInRange:matchRange withString:replacement]; } - return nil; + return string; } @end