Add support for unicode

Makes it not crash with a KeyError when passed data of unicode type.
Just utf-8 encodes the unicode to a str.