Skip to content

Commit

Permalink
Assume utf-8, not latin-1.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed May 23, 2017
1 parent c61e737 commit 639bf03
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Expand Up @@ -10,11 +10,13 @@
- The long-deprecated layer configuration was removed. It was only
ever available if the ``deprecatedlayers`` ZCML feature was installed.

- Modernize some of the templates. An increment towards having
zope.app.apidoc compatible with Chameleon.
- Modernize some of the templates. ``zope.app.apidoc`` can now be used
with Chameleon 3.2 via z3c.pt and z3c.ptcompat.

- Declared install dependency on ``zope.app.exception``.

- Docstrings are treated as UTF-8 on Python 2.

3.7.5 (2010-09-12)
==================

Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/apidoc/static.py
Expand Up @@ -131,7 +131,7 @@ def setUserAndPassword(self, user, pw):
"""Specify the username and password to use for the retrieval."""
user_pw = user + ':' + pw
if not isinstance(user_pw, bytes):
user_pw = user_pw.encode('latin-1')
user_pw = user_pw.encode('utf-8')
encoded = base64.b64encode(user_pw).strip()
if not isinstance(encoded, str):
encoded = encoded.decode('ascii')
Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/apidoc/utilities.py
Expand Up @@ -367,7 +367,7 @@ def renderText(text, module=None, format=None, dedent=True):
assert format in _format_dict.values()

if isinstance(text, bytes):
text = text.decode('latin-1', 'replace')
text = text.decode('utf-8', 'replace')

text = dedentString(text)
source = createObject(format, text)
Expand Down

0 comments on commit 639bf03

Please sign in to comment.