Don't assume that strings starting with a BOM are valid UTF-16.

Move the logic to catch invalid encoding outside the attempt
at UTF-16 decoding to catch byte arrays that start with a BOM.
Merge pull request #7 from josephw/master

Don't assume that strings starting with a BOM are valid UTF-16.