Commit d633d2f9 authored by Yay295's avatar Yay295

fix printing unicode to stdout

parent f19e3ce6
......@@ -368,5 +368,6 @@ def convert(lines, offset=0):
if __name__ == '__main__':
if len(sys.argv) > 1:
for line in convert([line.strip() for line in open(sys.argv[1], encoding='utf8') if line], int(sys.argv[2]) if len(sys.argv) > 2 else 0):
print(line)
with open(sys.argv[1], encoding='utf8') as file, open(1, 'w', encoding='utf8', closefd=False) as stdout:
for line in convert([line.strip() for line in file if line], int(sys.argv[2]) if len(sys.argv) > 2 else 0):
print(line, file=stdout)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment