diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-04-18 02:32:06 +0100 |
---|---|---|
committer | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2022-04-22 04:21:12 +0100 |
commit | 55669f6cfc03e96cee236dc9b9cdeb1deb31cef0 (patch) | |
tree | 4578b4b0b93346e2356de779cf4c0c06f31e0668 /sphinx/ext/coverage.py | |
parent | c08bffde98391a193debbeaee9af8c4f5ef8c77f (diff) | |
download | sphinx-git-55669f6cfc03e96cee236dc9b9cdeb1deb31cef0.tar.gz |
Specify encoding
Diffstat (limited to 'sphinx/ext/coverage.py')
-rw-r--r-- | sphinx/ext/coverage.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py index 3ebd095c2..1be815861 100644 --- a/sphinx/ext/coverage.py +++ b/sphinx/ext/coverage.py @@ -90,7 +90,7 @@ class CoverageBuilder(Builder): c_objects = self.env.domaindata['c']['objects'] for filename in self.c_sourcefiles: undoc: Set[Tuple[str, str]] = set() - with open(filename) as f: + with open(filename, encoding="utf-8") as f: for line in f: for key, regex in self.c_regexes: match = regex.match(line) @@ -108,7 +108,7 @@ class CoverageBuilder(Builder): def write_c_coverage(self) -> None: output_file = path.join(self.outdir, 'c.txt') - with open(output_file, 'w') as op: + with open(output_file, 'w', encoding="utf-8") as op: if self.config.coverage_write_headline: write_header(op, 'Undocumented C API elements', '=') op.write('\n') @@ -227,7 +227,7 @@ class CoverageBuilder(Builder): def write_py_coverage(self) -> None: output_file = path.join(self.outdir, 'python.txt') failed = [] - with open(output_file, 'w') as op: + with open(output_file, 'w', encoding="utf-8") as op: if self.config.coverage_write_headline: write_header(op, 'Undocumented Python objects', '=') keys = sorted(self.py_undoc.keys()) |