Assert text files are in utf8 (#350)

Read and write text files with utf8 encoding.

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
Bobby Noelte
2025-01-07 19:31:44 +01:00
committed by GitHub
parent ef60f5b9f5
commit d2f6e9866d
7 changed files with 14 additions and 14 deletions

View File

@@ -150,7 +150,7 @@ def main():
try:
if args.input_file:
with open(args.input_file, "r") as f:
with open(args.input_file, "r", encoding="utf8") as f:
content = f.read()
elif args.input:
content = args.input
@@ -164,7 +164,7 @@ def main():
)
if args.output_file:
# Write to file
with open(args.output_file, "w") as f:
with open(args.output_file, "w", encoding="utf8") as f:
f.write(extracted_content)
else:
# Write to std output

View File

@@ -150,7 +150,7 @@ def main():
config_md = generate_config_md()
if args.output_file:
# Write to file
with open(args.output_file, "w") as f:
with open(args.output_file, "w", encoding="utf8") as f:
f.write(config_md)
else:
# Write to std output

View File

@@ -54,7 +54,7 @@ def main():
openapi_spec_str = json.dumps(openapi_spec, indent=2)
if args.output_file:
# Write to file
with open(args.output_file, "w") as f:
with open(args.output_file, "w", encoding="utf8") as f:
f.write(openapi_spec_str)
else:
# Write to std output

View File

@@ -286,7 +286,7 @@ def main():
openapi_md = generate_openapi_md()
if args.output_file:
# Write to file
with open(args.output_file, "w") as f:
with open(args.output_file, "w", encoding="utf8") as f:
f.write(openapi_md)
else:
# Write to std output