whois/__init__.py
changeset 136 30259bf0523f
parent 124 dfa8657bdefc
child 140 196df98347d8
--- a/whois/__init__.py	Tue Oct 24 15:23:48 2017 +0300
+++ b/whois/__init__.py	Sun Nov 26 01:04:03 2017 +0100
@@ -73,7 +73,7 @@
     if not suffixes:
         # downloaded from https://publicsuffix.org/list/public_suffix_list.dat
         tlds_path = os.path.join(os.getcwd(), os.path.dirname(__file__), 'data', 'public_suffix_list.dat')
-        with open(tlds_path) as tlds_fp:
+        with open(tlds_path, encoding='utf-8') as tlds_fp:
             suffixes = set(line.encode('utf-8') for line in tlds_fp.read().splitlines() if line and not line.startswith('//'))
 
     if not isinstance(url, str):
@@ -85,7 +85,7 @@
     domain = b''
     for section in reversed(url.split(b'.')):
         if domain:
-            domain = '.' + domain
+            domain = b'.' + domain
         domain = section + domain
         if domain not in suffixes:
             break