replace invalid utf8 characters

fixes #46