From 29affd2d9b50b892334447799eb0c351664b0250 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 6 Mar 2016 19:24:53 -0430 Subject: test passed because UnicodeEncodeError is a subclass of ValueError That's obviously not right. Hooray subclasses. --- src/cryptography/x509/name.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptography/x509/name.py b/src/cryptography/x509/name.py index c7f6f99d..d62341d7 100644 --- a/src/cryptography/x509/name.py +++ b/src/cryptography/x509/name.py @@ -22,7 +22,7 @@ class NameAttribute(object): "value argument must be a text type." ) - if oid == NameOID.COUNTRY_NAME and len(value.encode("ascii")) != 2: + if oid == NameOID.COUNTRY_NAME and len(value.encode("utf8")) != 2: raise ValueError( "Country name must be a 2 character country code" ) -- cgit v1.2.3