Fix usage of replace()

Upstream filter should fix most of these characters, this was largely just a safety check so I don't believe this was a problem.