diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 6e8279f7c..a99d50d58 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -696,7 +696,10 @@ class StandaloneHTMLBuilder(Builder): return uri ctx['pathto'] = pathto ctx['hasdoc'] = lambda name: name in self.env.all_docs - ctx['encoding'] = encoding = self.config.html_output_encoding + if self.name != 'htmlhelp': + ctx['encoding'] = encoding = self.config.html_output_encoding + else: + ctx['encoding'] = encoding = self.encoding ctx['toctree'] = lambda **kw: self._get_local_toctree(pagename, **kw) self.add_sidebars(pagename, ctx) ctx.update(addctx) diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index f5d716d98..79c2e6058 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -258,8 +258,8 @@ class HTMLHelpBuilder(StandaloneHTMLBuilder): def write_index(title, refs, subitems): def write_param(name, value): item = ' \n' % (name, value) - f.write(item.encode('ascii', 'xmlcharrefreplace') - .decode('ascii')) + f.write(item.encode(self.encoding, 'xmlcharrefreplace') + .decode(self.encoding)) title = cgi.escape(title) f.write('
  • \n') write_param('Keyword', title) diff --git a/sphinx/pycode/pgen2/driver.py b/sphinx/pycode/pgen2/driver.py index 39e347b79..5e6cf9a5b 100644 --- a/sphinx/pycode/pgen2/driver.py +++ b/sphinx/pycode/pgen2/driver.py @@ -120,7 +120,7 @@ def load_grammar(gt="Grammar.txt", gp=None, head, tail = os.path.splitext(gt) if tail == ".txt": tail = "" - gp = head + tail + ".".join(map(str, sys.version_info)) + ".pickle" + gp = head + tail + ".".join(map(str, sys.version_info[:2])) + ".pickle" if force or not _newer(gp, gt): logger.info("Generating grammar tables from %s", gt) g = pgen.generate_grammar(gt)