aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorredshiftzero <jen@freedom.press>2019-04-15 22:46:57 -0700
committerPaul Kehrer <paul.l.kehrer@gmail.com>2019-04-16 13:46:57 +0800
commit276f5c49d55b5ff7694f2f35ae538282ec360e7d (patch)
tree9694366e1abaa7a8ab5e693b55d3221e3454c015 /src
parent19db013fa66fb4eb38e105e7fd46599aad51bf30 (diff)
downloadcryptography-276f5c49d55b5ff7694f2f35ae538282ec360e7d.tar.gz
cryptography-276f5c49d55b5ff7694f2f35ae538282ec360e7d.tar.bz2
cryptography-276f5c49d55b5ff7694f2f35ae538282ec360e7d.zip
4810 bugfix: avoid UnicodeEncodeError on python 2 (#4846)
* test: regression test for UnicodeEncodeError in x509 name in #4810 added utf8 encoding at the top of the file due to PEP 263 * bugfix: #4810 resolve UnicodeEncodeError in x509 name
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509/name.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py
index dac5639e..ca2a1754 100644
--- a/src/cryptography/x509/name.py
+++ b/src/cryptography/x509/name.py
@@ -253,4 +253,7 @@ class Name(object):
return sum(len(rdn) for rdn in self._attributes)
def __repr__(self):
- return "<Name({})>".format(self.rfc4514_string())
+ if six.PY2:
+ return "<Name({})>".format(self.rfc4514_string().encode('utf8'))
+ else:
+ return "<Name({})>".format(self.rfc4514_string())