Fix encoding suddenly changing bug.