Skip to content

Commit

Permalink
Minor fixup for HTML.decode_codepoint (#13843)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Sep 27, 2023
1 parent e291c62 commit 6b9ad16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/html.cr
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ module HTML
case codepoint
when 0x80..0x9F
# Replace characters from Windows-1252 with UTF-8 equivalents.
CHARACTER_REPLACEMENTS[codepoint - 0x80].to_s
CHARACTER_REPLACEMENTS[codepoint - 0x80]
when 0,
.>(Char::MAX_CODEPOINT),
0xD800..0xDFFF # unicode surrogate characters
Expand All @@ -175,7 +175,7 @@ module HTML
(0xFDD0..0xFDEF).includes?(codepoint) ||
# last two of each plane (nonchars) disallowed
codepoint & 0xFFFF >= 0xFFFE ||
# unicode control characters expect space
# unicode control characters except space
(codepoint < 0x0020 && !codepoint.in?(0x0009, 0x000A, 0x000C))
codepoint.unsafe_chr
end
Expand Down

0 comments on commit 6b9ad16

Please sign in to comment.