Fix encoding conversion