diff options
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>"); |