Skip to content

Commit 98d95f0

Browse files
Merge pull request #17015 from eschnett/patch-1
[CI:DOCS] Preprocess files in UTF-8 mode
2 parents b7314bd + 7826e1c commit 98d95f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

hack/markdown-preprocess

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Preprocessor():
3838
outfile = os.path.splitext(infile)[0]
3939
outfile_tmp = outfile + '.tmp.' + str(os.getpid())
4040

41-
with open(infile, 'r') as fh_in, open(outfile_tmp, 'w') as fh_out:
41+
with open(infile, 'r', encoding='utf-8') as fh_in, open(outfile_tmp, 'w', encoding='utf-8') as fh_out:
4242
for line in fh_in:
4343
# '@@option foo' -> include file options/foo.md
4444
if line.startswith('@@option '):
@@ -71,7 +71,7 @@ class Preprocessor():
7171
"""
7272
for optionfile in self.used_by:
7373
tmpfile = optionfile + '.tmp'
74-
with open(optionfile, 'r') as fh_in, open(tmpfile, 'w') as fh_out:
74+
with open(optionfile, 'r', encoding='utf-8') as fh_in, open(tmpfile, 'w', encoding='utf-8') as fh_out:
7575
fh_out.write("####> This option file is used in:\n")
7676
used_by = ', '.join(x for x in self.used_by[optionfile])
7777
fh_out.write(f"####> podman {used_by}\n")
@@ -96,7 +96,7 @@ class Preprocessor():
9696
# treats them as one line and will unwantedly render the
9797
# comment in its output.
9898
fh_out.write("\n[//]: # (BEGIN included file " + path + ")\n")
99-
with open(path, 'r') as fh_included:
99+
with open(path, 'r', encoding='utf-8') as fh_included:
100100
for opt_line in fh_included:
101101
if opt_line.startswith('####>'):
102102
continue

0 commit comments

Comments
 (0)