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('