import codecs # read with codecs.open(fname, "r", "utf-8") as f: text = f.read() # write with codecs.open(tmp, "w", "utf-8") as to: to.write(text)