diff options
author | default <nobody@localhost> | 2023-10-04 18:19:38 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2023-10-04 18:19:38 +0200 |
commit | b1868d85bbd9a707c487c9d2e277c6c038478db6 (patch) | |
tree | b6b7a1348b571dcbf2e5e8b6fca02d53ae92239e /format.c | |
parent | 9e87652571127a10c8edbd220409b96be36eb3b8 (diff) |
New function encode_html_strict().
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -260,7 +260,7 @@ xs_str *sanitize(const char *content) } -xs_str *encode_html(const char *str) +xs_str *encode_html_strict(const char *str) /* escapes html characters */ { xs_str *encoded = xs_replace(str, "&", "&"); @@ -269,6 +269,15 @@ xs_str *encode_html(const char *str) encoded = xs_replace_i(encoded, "\"", """); encoded = xs_replace_i(encoded, "'", "'"); + return encoded; +} + + +xs_str *encode_html(const char *str) +/* escapes html characters */ +{ + xs_str *encoded = encode_html_strict(str); + /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */ encoded = xs_replace_i(encoded, "<br>", "<br>"); |