Update the filters to escape the characters before replacing them.

This prevents the filters from allowing XSS attacks. This follows
the pattern used by django's linebreaksbr filter.