Handle special characters in topic comments and attachments (33245223)

When a topic is displayed, any invalid characters in its attachments or comments are removed and replaced with the Unicode black square character (■).

Ported from #28057529 included in 9.1.0.5.