From f5f42464f6d0f84dacc6d1925de9d4548984d71e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 17 Mar 2024 12:08:36 -0400 Subject: [PATCH] Fix lowercase hex digit character references not being tokenized --- Sources/HTMLStreamer/Tokenizer.swift | 12 ++++++------ Tests/HTMLStreamerTests/TokenizerTests.swift | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/HTMLStreamer/Tokenizer.swift b/Sources/HTMLStreamer/Tokenizer.swift index cc90048..23843cf 100644 --- a/Sources/HTMLStreamer/Tokenizer.swift +++ b/Sources/HTMLStreamer/Tokenizer.swift @@ -1555,12 +1555,12 @@ private extension Unicode.Scalar { case "7": 7 case "8": 8 case "9": 9 - case "A": 0xA - case "B": 0xB - case "C": 0xC - case "D": 0xD - case "E": 0xE - case "F": 0xF + case "A", "a": 0xA + case "B", "b": 0xB + case "C", "c": 0xC + case "D", "d": 0xD + case "E", "e": 0xE + case "F", "f": 0xF default: nil } } diff --git a/Tests/HTMLStreamerTests/TokenizerTests.swift b/Tests/HTMLStreamerTests/TokenizerTests.swift index 47c6935..4674f89 100644 --- a/Tests/HTMLStreamerTests/TokenizerTests.swift +++ b/Tests/HTMLStreamerTests/TokenizerTests.swift @@ -33,6 +33,8 @@ final class TokenizerTests: XCTestCase { func testNumericCharacterReference() { XCTAssertEqual(tokenize("!"), [.characterSequence("!")]) XCTAssertEqual(tokenize("!"), [.characterSequence("!")]) + XCTAssertEqual(tokenize("J"), [.characterSequence("J")]) + XCTAssertEqual(tokenize("J"), [.characterSequence("J")]) } func testStartTag() {