Stricter encoding detection/converison. Fixes #11.