replace problematic characters with their HTML codes