From cdc45669a2deec3c76a57947bb9c74042194446a Mon Sep 17 00:00:00 2001 From: wolfpan Date: Mon, 23 Nov 2020 08:32:01 +0800 Subject: [PATCH] explicitly specify encoding=utf-8 in apidoc --- sphinx/util/osutil.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 0390b038d..59fd059e6 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -222,14 +222,14 @@ class FileAvoidWrite: self._io.close() try: - with open(self._path) as old_f: + with open(self._path, encoding='utf-8') as old_f: old_content = old_f.read() if old_content == buf: return except OSError: pass - with open(self._path, 'w') as f: + with open(self._path, 'w', encoding='utf-8') as f: f.write(buf) def __enter__(self) -> "FileAvoidWrite":