utils/table-generator/convert.py: вказав кодування UTF-8 для роботи з файлами
This commit is contained in:
parent
d67567d304
commit
06b52b1efc
|
@ -96,7 +96,7 @@ if __name__=="__main__":
|
||||||
|
|
||||||
if len(files) == 1:
|
if len(files) == 1:
|
||||||
name = files[0]
|
name = files[0]
|
||||||
data = open(name).read()
|
data = open(name, encoding = "utf-8").read()
|
||||||
|
|
||||||
if usecase_formatting == YES:
|
if usecase_formatting == YES:
|
||||||
if verbose == YES:
|
if verbose == YES:
|
||||||
|
@ -113,14 +113,14 @@ if __name__=="__main__":
|
||||||
print(formatted_table_data)
|
print(formatted_table_data)
|
||||||
|
|
||||||
if write_to_file > AUTO:
|
if write_to_file > AUTO:
|
||||||
open(name + ".table", 'w').write(data+"\n")
|
open(name + ".table", 'w', encoding = "utf-8").write(data+"\n")
|
||||||
|
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
for no, name in enumerate(sys.argv[1:]):
|
for no, name in enumerate(sys.argv[1:]):
|
||||||
print(f"Converting {no+1}/{len(sys.argv)}")
|
print(f"Converting {no+1}/{len(sys.argv)}")
|
||||||
|
|
||||||
data = open(name).read()
|
data = open(name, encoding = "utf-8").read()
|
||||||
|
|
||||||
if usecase_formatting == YES:
|
if usecase_formatting == YES:
|
||||||
if verbose >= AUTO:
|
if verbose >= AUTO:
|
||||||
|
@ -137,4 +137,4 @@ if __name__=="__main__":
|
||||||
print(formatted_table_data)
|
print(formatted_table_data)
|
||||||
|
|
||||||
if write_to_file >= AUTO:
|
if write_to_file >= AUTO:
|
||||||
open(name + ".table", 'w').write(data+"\n")
|
open(name + ".table", 'w', encoding = "utf-8").write(data+"\n")
|
||||||
|
|
Reference in New Issue