c0d655e157b7e29f988e6bb9416578d6ac08f40f hiram Thu Sep 12 19:15:10 2024 -0700 open the tsv file as latin-1 encoding to handle extended characters refs #34337 diff --git src/hg/makeDb/doc/asmHubs/tsvToJson.py src/hg/makeDb/doc/asmHubs/tsvToJson.py index 8240488..9548b22 100755 --- src/hg/makeDb/doc/asmHubs/tsvToJson.py +++ src/hg/makeDb/doc/asmHubs/tsvToJson.py @@ -292,24 +292,24 @@ print("Usage: ./commonNames.py <filename|stdin>", file=sys.stderr) print("e.g.: ./commonNames.py some.asmId.list", file=sys.stderr) print(" where some.asmId.list is a simple list of NCBI assembly ids", file=sys.stderr) print(" will look up the common names for each ID from the assembly_report files", file=sys.stderr) sys.exit(1) # Ensure stdout and stderr use UTF-8 encoding setUtf8Encoding() listFile = sys.argv[1] if listFile == 'stdin': fileIn = sys.stdin else: try: - fileIn = open(listFile, 'r') + fileIn = open(listFile, 'r', encoding='latin-1') except FileNotFoundError: print(f"Error: File '{listFile}' not found.", file=sys.stderr) sys.exit(1) processList(fileIn) if __name__ == "__main__": main()