Mercurial > repos > davidvanzessen > argalaxy_tools
view convert_windows_to_utf-8.py @ 58:4c6df851e262 draft default tip
"planemo upload commit 1a7731bb4fe2e80fb1fdc88121783068af3edb08"
author | rhpvorderman |
---|---|
date | Fri, 21 Apr 2023 10:04:39 +0000 |
parents | |
children |
line wrap: on
line source
import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("files", nargs="+") args = parser.parse_args() for file in args.files: with open(file, "rb") as in_r: data = in_r.read() text = data.decode("windows-1252") text = text.replace("charset=windows-1252", "charset=\"UTF-8\"", 1) with open(file, "wt", encoding="UTF-8") as out: out.write(text)