Fix up string/bytes/encoding issue by doing it ourselves.