The two lines you mean?
<head>
<title>my title</title>
<meta name="description" content="my title">
<meta name="keywords" content="my title">
<meta name="classification" content="windows">
</head>
#data = open(file, "r").read() #data.encode(encoding = 'UTF-8', errors = 'strict') data = rawdata.decode(encoding=encoding) #with open(file, 'w', encoding='utf-8') as outp: with open(file, 'wb') as outp: outp.write(data) #TypeError: a bytes-like object is required, not 'str'CHECK LATER It still doesn't work: Files that were supposedly converted to utf-8 in the first run are still considered as Windows files:
if encoding in ["Windows-1252","ascii","ISO-8859-1"]: print("File still not in utf-8",file) continueAlso, the code above adds new carriage returns in the output :-/
<head>
<title>my title</title>
<meta name="description" content="my title">
<meta name="keywords" content="my title">
<meta name="classification" content="windows">
</head>