diff options
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) | |||
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | 262 | ||
| 263 | xs_str *encode_html(const char *str) | 263 | xs_str *encode_html_strict(const char *str) |
| 264 | /* escapes html characters */ | 264 | /* escapes html characters */ |
| 265 | { | 265 | { |
| 266 | xs_str *encoded = xs_replace(str, "&", "&"); | 266 | xs_str *encoded = xs_replace(str, "&", "&"); |
| @@ -269,6 +269,15 @@ xs_str *encode_html(const char *str) | |||
| 269 | encoded = xs_replace_i(encoded, "\"", """); | 269 | encoded = xs_replace_i(encoded, "\"", """); |
| 270 | encoded = xs_replace_i(encoded, "'", "'"); | 270 | encoded = xs_replace_i(encoded, "'", "'"); |
| 271 | 271 | ||
| 272 | return encoded; | ||
| 273 | } | ||
| 274 | |||
| 275 | |||
| 276 | xs_str *encode_html(const char *str) | ||
| 277 | /* escapes html characters */ | ||
| 278 | { | ||
| 279 | xs_str *encoded = encode_html_strict(str); | ||
| 280 | |||
| 272 | /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */ | 281 | /* Restore only <br>. Probably safe. Let's hope nothing goes wrong with this. */ |
| 273 | encoded = xs_replace_i(encoded, "<br>", "<br>"); | 282 | encoded = xs_replace_i(encoded, "<br>", "<br>"); |
| 274 | 283 | ||