summaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2023-11-20 18:33:24 +0100
committerdefault <nobody@localhost>2023-11-20 18:33:24 +0100
commitbc5d0d4ed09833640856ee0193a53553dbb1eb20 (patch)
treeafd97135fb606445cb8f5348ae2857cb3088dbd8 /format.c
parentb68ed66669aa65bda1c55b9dcd7afcc126c7c2cf (diff)
Replaced encode_html_strict() with xs_html_encode().
Diffstat (limited to 'format.c')
-rw-r--r--format.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/format.c b/format.c
index cfe2294..019260c 100644
--- a/format.c
+++ b/format.c
@@ -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, "&", "&amp;");
- encoded = xs_replace_i(encoded, "<", "&lt;");
- encoded = xs_replace_i(encoded, ">", "&gt;");
- encoded = xs_replace_i(encoded, "\"", "&#34;");
- encoded = xs_replace_i(encoded, "'", "&#39;");
-
- 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, "&lt;br&gt;", "<br>");