Skip to content

Commit 7500f0a

Browse files
author
Ángel González
committed
Prefer latin-1 to the replacement character it not utf-8
Closes joepie91#135
2 parents d4cec15 + 93672ea commit 7500f0a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pythonwhois/net.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,10 @@ def whois_request(domain, server, port=43, timeout=None):
109109
if len(data) == 0:
110110
break
111111
buff += data
112-
return buff.decode("utf-8", "replace")
112+
try:
113+
d = buff.decode("utf-8")
114+
except UnicodeDecodeError:
115+
d = buff.decode("latin-1", "replace")
116+
117+
return d
118+

0 commit comments

Comments
 (0)