Remove NULL bytes from text messages
Remove NULL bytes from text messages

They are likely to trip up many things later,
including our own C-based Markdown-to-HTML convertor.

Normally, we don't expect people to be entering NULL bytes in
messages, but because of a bug in iOS 11, it's easy to have it happen.

iOS 11's Smart Punctuation feature "conveniently" converts double
hyphens (`--`) to longer en-dashes (`—`).
However, when adding any kind of dash/hyphen after such an
en-dash, iOS would also insert a NULL byte inbetween the dashes
(`<en-dash>NULL<some other dash>`).

Even if a future iOS update fixes this, we'd better be defensive
and always remove occurrences of NULL bytes from text messages.

Signed-off-by: Slavi Pantaleev <018f1c5d0b0446d0b5f0fcc3b1fe8269e0d0200a@gmail.com>

matrix-org/matrix-ios-kit,matrix-org/matrix-ios-kit,matrix-org/matrix-ios-kit,matrix-org/matrix-ios-kit