Fix UTF encoding and do loops