Skip to content

Commit ac992ee

Browse files
committed
Set encoding='utf-8' to ease backports
1 parent 99c82d1 commit ac992ee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/tools/check-html-ids.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def handle_starttag(self, tag, attrs):
3434
def get_ids_from_file(path):
3535
ids = set()
3636
gatherer = IDGatherer(ids)
37-
with path.open() as file:
37+
with path.open(encoding='utf-8') as file:
3838
while chunk := file.read(4096):
3939
gatherer.feed(chunk)
4040
return ids
@@ -145,7 +145,7 @@ def verbose_print(*args, **kwargs):
145145
ids = gather_ids(args.htmldir, verbose_print=verbose_print)
146146
if args.outfile is None:
147147
args.outfile = args.htmldir / 'html-ids.json.gz'
148-
with gzip.open(args.outfile, 'wt') as zfile:
148+
with gzip.open(args.outfile, 'wt', encoding='utf-8') as zfile:
149149
json.dump({'ids_by_page': ids}, zfile)
150150

151151
if args.command == 'check':
@@ -155,7 +155,7 @@ def verbose_print(*args, **kwargs):
155155
checked = json.load(zfile)['ids_by_page']
156156
excluded = set()
157157
if args.exclude_file:
158-
with open(args.exclude_file) as file:
158+
with open(args.exclude_file, encoding='utf-8') as file:
159159
for line in file:
160160
line = line.strip()
161161
if line and not line.startswith('#'):

0 commit comments

Comments
 (0)