Add tests for invalid input, and some fixes. Resolves #2
Merge branch 'master' of https://github.com/inexorabletash/text-encoding