Use the encoding helper in diff

Uses the encoding helper for cleaning up encodings in the diff.