Ensure correct encoding