aboutsummaryrefslogtreecommitdiff
path: root/core/encoding/entity
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-19 19:30:37 +0000
committergingerBill <gingerBill@users.noreply.github.com>2026-01-19 19:30:37 +0000
commit85b3251105d22d96357cd6e79a0e34dd3a62d517 (patch)
tree5841a47586249d8aadad28f4b0c4c8ed9e8eb4b8 /core/encoding/entity
parent093f088396f99838450b58f2aa48cae22ade5ab6 (diff)
Remove the nbsp change, as it is not necessary
Diffstat (limited to 'core/encoding/entity')
-rw-r--r--core/encoding/entity/entity.odin7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/encoding/entity/entity.odin b/core/encoding/entity/entity.odin
index 89155b3a7..bc3a79635 100644
--- a/core/encoding/entity/entity.odin
+++ b/core/encoding/entity/entity.odin
@@ -263,7 +263,7 @@ xml_decode_entity :: proc(entity: string) -> (decoded: [2]rune, rune_count: int,
// escape_html escapes special characters like '&' to become '&amp;'.
-// It escapes only 6 different characters: & ' < > " and non-breaking space.
+// It escapes only 5 different characters: & ' < > and "
@(require_results)
escape_html :: proc(s: string, allocator := context.allocator, loc := #caller_location) -> (output: string, was_allocation: bool) {
/*
@@ -272,21 +272,19 @@ escape_html :: proc(s: string, allocator := context.allocator, loc := #caller_lo
< -> &lt;
> -> &gt;
" -> &#34; // &#34; is shorter than &quot;
- 0x6a -> &nbsp;
*/
b := transmute([]byte)s
extra_bytes_needed := 0
- for c in b {
+ for c, i in b {
switch c {
case '&': extra_bytes_needed += 4
case '\'': extra_bytes_needed += 4
case '<': extra_bytes_needed += 3
case '>': extra_bytes_needed += 3
case '"': extra_bytes_needed += 4
- case 0xa0: extra_bytes_needed += 5
}
}
@@ -309,7 +307,6 @@ escape_html :: proc(s: string, allocator := context.allocator, loc := #caller_lo
case '<': x = "&lt;"
case '>': x = "&gt;"
case '"': x = "&#34;"
- case 0xa0: x = "&nbsp;"
}
if x != "" {
copy(t[w:], x)