Skip to content

Commit

Permalink
Prefer latin-1 to the replacement character it not utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Ángel González committed Dec 14, 2017
2 parents d4cec15 + 93672ea commit 7500f0a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pythonwhois/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ def whois_request(domain, server, port=43, timeout=None):
if len(data) == 0:
break
buff += data
return buff.decode("utf-8", "replace")
try:
d = buff.decode("utf-8")
except UnicodeDecodeError:
d = buff.decode("latin-1", "replace")

return d

0 comments on commit 7500f0a

Please sign in to comment.