fix #6540: utf16(s) for binary data, etc.

This patch adds `utf16(s)` for binary data, an `is_valid_utf16(s)` function analogous to `is_valid_utf8`, and restricts `IOBuffer(s::String)` to `ByteString`s as discussed in #6540.