Encode lazily only in case of a unicode error