whois/whois.py
changeset 34 f9da616f15cf
parent 32 5f851e9c196a
child 36 af839b9c0ed1
--- a/whois/whois.py	Fri Aug 15 11:59:58 2014 +0300
+++ b/whois/whois.py	Fri Aug 15 13:31:24 2014 +0300
@@ -127,12 +127,15 @@
         """send takes bytes as an input
         """
         queryBytes = None
+        if type(query) is not unicode:
+            query = query.decode('utf-8')
+
         if (hostname == NICClient.DENICHOST):
             # print 'the domain is in NIC DENIC'
-            queryBytes = ("-T dn,ace -C UTF-8 " + query + "\r\n").encode()
+            queryBytes = ("-T dn,ace -C UTF-8 " + query + "\r\n").encode('idna')
             # print 'queryBytes:', queryBytes
         else:
-            queryBytes = (query + "\r\n").encode()
+            queryBytes = (query + "\r\n").encode('idna')
         s.send(queryBytes)
         """recv returns bytes
         """