Skip to content

Commit

Permalink
Update chpl2rst.py to explicitly use UTF-8 encoding
Browse files Browse the repository at this point in the history
Follow-up to PR chapel-lang#16560 and chapel-lang#16608

---
Signed-off-by: Michael Ferguson <mppf@users.noreply.github.com>
  • Loading branch information
mppf committed Oct 23, 2020
1 parent c15a3a6 commit 3a7cd60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/util/chpl2rst.py
Expand Up @@ -95,7 +95,7 @@ def titlecomment(line):

def gen_title(chapelfile):
"""Generate file title, based on if title comment exists"""
with open(chapelfile, 'r') as handle:
with open(chapelfile, 'r', encoding='utf-8') as handle:
line1 = handle.readline()
if titlecomment(line1):
title = line1.lstrip('//').strip()
Expand Down Expand Up @@ -268,7 +268,7 @@ def write(rstoutput, output):
sys.stdout.write(rstoutput)
return

with open(output, 'w') as handle:
with open(output, 'w', encoding='utf-8') as handle:
handle.write(rstoutput)


Expand All @@ -287,7 +287,7 @@ def main(**kwargs):

preamble = gen_preamble(chapelfile, link=link)

with open(chapelfile, 'r') as handle:
with open(chapelfile, 'r', encoding='utf-8') as handle:
if codeblock:
rstoutput = gen_codeblock(handle)
else:
Expand Down

0 comments on commit 3a7cd60

Please sign in to comment.