Fix problems with encoding