diff -r 808c8bc803f5 -r 30259bf0523f whois/whois.py --- a/whois/whois.py Tue Oct 24 15:23:48 2017 +0300 +++ b/whois/whois.py Sun Nov 26 01:04:03 2017 +0100 @@ -115,7 +115,7 @@ query_bytes = '=' + query else: query_bytes = query - s.send((query_bytes) + b"\r\n") + s.send(bytes(query_bytes,'utf-8') + b"\r\n") # recv returns bytes while True: d = s.recv(4096) @@ -142,6 +142,8 @@ domain = domain.encode('idna').decode('utf-8') except TypeError: domain = domain.decode('utf-8').encode('idna').decode('utf-8') + except AttributeError: + domain = domain.decode('utf-8').encode('idna').decode('utf-8') if domain.endswith("-NORID"): return NICClient.NORIDHOST if domain.endswith("id"):