# HG changeset patch # User Richard Penman # Date 1458137916 -3600 # Node ID 359baebcf0e83ec5cd5a3a2f8915535f5b58114e # Parent fa9650e9ec23061db70a8f50cd127cb931b7af96# Parent 95f170b4fd131a629a95f6054157587a8adab660 merged diff -r 95f170b4fd13 -r 359baebcf0e8 setup.py --- a/setup.py Wed Mar 02 10:36:21 2016 +0000 +++ b/setup.py Wed Mar 16 15:18:36 2016 +0100 @@ -1,7 +1,7 @@ import sys, os import setuptools -version = '0.6' +version = '0.6.1' setuptools.setup( name='python-whois', diff -r 95f170b4fd13 -r 359baebcf0e8 whois/whois.py --- a/whois/whois.py Wed Mar 02 10:36:21 2016 +0000 +++ b/whois/whois.py Wed Mar 16 15:18:36 2016 +0100 @@ -38,9 +38,6 @@ import optparse -def enforce_ascii(a): - return a if isinstance(a, bytes) else bytes([63 if ord(c) > 127 else ord(c) for c in a]).decode('ascii') - class NICClient(object): ABUSEHOST = "whois.abuse.net" @@ -123,14 +120,15 @@ return '' else: nhost = None - response = enforce_ascii(response) + response = response.decode('utf-8') if b'with "=xxx"' in response: return self.whois(query, hostname, flags, True) if flags & NICClient.WHOIS_RECURSE and nhost is None: - nhost = self.findwhois_server(response.decode(), hostname, query) + nhost = self.findwhois_server(response, hostname, query) if nhost is not None: - response += self.whois(query, nhost, 0).encode('utf-8') - return response.decode() + response += self.whois(query, nhost, 0) + return response + def choose_server(self, domain): """Choose initial lookup NIC host"""