whois/whois.py
changeset 136 30259bf0523f
parent 134 3ff7f09ea24a
child 160 c385321ec3e4
child 162 93f6f3021941
--- 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"):