Resolve issues with string encodings (fixes #26)