Fixing text encoding in generated images