fix encoding conversion bug