diff options
author | default <nobody@localhost> | 2023-11-20 18:33:24 +0100 |
---|---|---|
committer | default <nobody@localhost> | 2023-11-20 18:33:24 +0100 |
commit | bc5d0d4ed09833640856ee0193a53553dbb1eb20 (patch) | |
tree | afd97135fb606445cb8f5348ae2857cb3088dbd8 /format.c | |
parent | b68ed66669aa65bda1c55b9dcd7afcc126c7c2cf (diff) |
Replaced encode_html_strict() with xs_html_encode().
Diffstat (limited to 'format.c')
-rw-r--r-- | format.c | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -4,6 +4,7 @@ #include "xs.h" #include "xs_regex.h" #include "xs_mime.h" +#include "xs_html.h" #include "snac.h" @@ -260,23 +261,10 @@ xs_str *sanitize(const char *content) } -xs_str *encode_html_strict(const char *str) -/* escapes html characters */ -{ - xs_str *encoded = xs_replace(str, "&", "&"); - encoded = xs_replace_i(encoded, "<", "<"); - encoded = xs_replace_i(encoded, ">", ">"); - 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); + xs_str *encoded = xs_html_encode((char *)str); /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */ encoded = xs_replace_i(encoded, "<br>", "<br>"); |