Skip to content

Commit 93672ea

Browse files
authored
Update net.py
This change avoid the unbearable error related to "utf codec can't decode".
1 parent 7b0ddf7 commit 93672ea

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pythonwhois/net.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,9 @@ def whois_request(domain, server, port=43):
9191
if len(data) == 0:
9292
break
9393
buff += data
94-
return buff.decode("utf-8")
94+
try:
95+
d = buff.decode("utf-8")
96+
except UnicodeDecodeError:
97+
d = buff.decode("latin-1")
98+
99+
return d

0 commit comments

Comments
 (0)