Convert non-utf8-files to utf-8

If an error occured while reading the file, try to guess its encoding with chardet and change the encoding to utf-8.