Skip to content

Commit 6fea1b8

Browse files
committed
Rewrite THTML.Entities to operate better with Unicode
Fixes #17
1 parent 1ba059f commit 6fea1b8

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Src/UHTMLUtils.pas

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,12 @@ class function THTML.Entities(const Text: string): string;
227227
for Ch in Text do
228228
begin
229229
case Ch of
230-
'<':
231-
SB.Append('&lt;');
232-
'>':
233-
SB.Append('&gt;');
234-
'&':
235-
SB.Append('&amp;');
236-
DOUBLEQUOTE:
237-
SB.Append('&quot;');
238-
#0..#9, #11, #12, #14..#31:
239-
SB.Append('&#' + IntToStr(Ord(Ch)) + ';')
240-
else
241-
SB.Append(Ch);
230+
LT: SB.Append('&lt;');
231+
GT: SB.Append('&gt;');
232+
SINGLEQUOTE: SB.Append('&apos;');
233+
DOUBLEQUOTE: SB.Append('&quot;');
234+
AMPERSAND: SB.Append('&amp;');
235+
else SB.Append(Ch);
242236
end;
243237
end;
244238
Result := SB.ToString;

0 commit comments

Comments
 (0)