summaryrefslogtreecommitdiff
path: root/sphinx/ext/githubpages.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-18 02:32:06 +0100
committerAdam Turner <9087854+AA-Turner@users.noreply.github.com>2022-04-22 04:21:12 +0100
commit55669f6cfc03e96cee236dc9b9cdeb1deb31cef0 (patch)
tree4578b4b0b93346e2356de779cf4c0c06f31e0668 /sphinx/ext/githubpages.py
parentc08bffde98391a193debbeaee9af8c4f5ef8c77f (diff)
downloadsphinx-git-55669f6cfc03e96cee236dc9b9cdeb1deb31cef0.tar.gz
Specify encoding
Diffstat (limited to 'sphinx/ext/githubpages.py')
-rw-r--r--sphinx/ext/githubpages.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/sphinx/ext/githubpages.py b/sphinx/ext/githubpages.py
index e250fb2f2..53e063a11 100644
--- a/sphinx/ext/githubpages.py
+++ b/sphinx/ext/githubpages.py
@@ -11,13 +11,14 @@ from sphinx.environment import BuildEnvironment
def create_nojekyll_and_cname(app: Sphinx, env: BuildEnvironment) -> None:
if app.builder.format == 'html':
- open(os.path.join(app.builder.outdir, '.nojekyll'), 'wt').close()
+ open(os.path.join(app.builder.outdir, '.nojekyll'), 'wb').close()
html_baseurl = app.config.html_baseurl
if html_baseurl:
domain = urllib.parse.urlparse(html_baseurl).hostname
if domain and not domain.endswith(".github.io"):
- with open(os.path.join(app.builder.outdir, 'CNAME'), 'wt') as f:
+ with open(os.path.join(app.builder.outdir, 'CNAME'), 'w',
+ encoding="utf-8") as f:
# NOTE: don't write a trailing newline. The `CNAME` file that's
# auto-generated by the Github UI doesn't have one.
f.write(domain)