Handle UTF-8 properly

Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1013347
Merge pull request #8 from mozilla/unicode-fixes-for-bz1013347

Handle UTF-8 properly