Pass all domains through encode('idna') in NICClient
This makes sure that non-ascii domains will be properly encoded in punnycode
before sending the whois query to the server.
--- 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
"""