From aa008900c94ea3fd8545d66c2694e2dc40edb8ff Mon Sep 17 00:00:00 2001 From: iska Date: Sat, 11 Apr 2015 00:18:39 +0200 Subject: [PATCH] Fix the input stream reader method for the CDATA Section state - All carriage returns must be converted to line feeds - All line feeds following a carriage return must be ignored https://html.spec.whatwg.org/multipage/syntax.html#preprocessing-the-input-stream --- HTMLKit/HTMLInputStreamReader.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HTMLKit/HTMLInputStreamReader.m b/HTMLKit/HTMLInputStreamReader.m index 9f4878a..b2fcb88 100644 --- a/HTMLKit/HTMLInputStreamReader.m +++ b/HTMLKit/HTMLInputStreamReader.m @@ -188,6 +188,8 @@ NSString *consumed; [_scanner scanUpToString:string intoString:&consumed]; _location = _scanner.scanLocation; + consumed = [consumed stringByReplacingOccurrencesOfString:@"\r\n" withString:@"\r"]; + consumed = [consumed stringByReplacingOccurrencesOfString:@"\r" withString:@"\n"]; return consumed; }