From 639bf0302d3f2a36cb04eab6892856a188af22d2 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Tue, 23 May 2017 16:14:13 -0500 Subject: [PATCH] Assume utf-8, not latin-1. --- CHANGES.rst | 6 ++++-- src/zope/app/apidoc/static.py | 2 +- src/zope/app/apidoc/utilities.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index f1ab80f0..47989d55 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) ================== diff --git a/src/zope/app/apidoc/static.py b/src/zope/app/apidoc/static.py index 370e6193..7b4ed433 100644 --- a/src/zope/app/apidoc/static.py +++ b/src/zope/app/apidoc/static.py @@ -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') diff --git a/src/zope/app/apidoc/utilities.py b/src/zope/app/apidoc/utilities.py index bcbc329d..493b168a 100644 --- a/src/zope/app/apidoc/utilities.py +++ b/src/zope/app/apidoc/utilities.py @@ -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)