Let's not crash if passed invalid utf-8 strings.
Merge pull request #2 from cosm/encoding

Let's not crash if passed invalid utf-8 strings.