Redesign the character re-encoding code.