Replace invalid byte codes when encoding unstructured fields.