From 93672eab271370af87bfbd2b0445131ed8ce23f9 Mon Sep 17 00:00:00 2001 From: Raphael Denipotti Date: Mon, 13 Nov 2017 22:17:18 -0200 Subject: [PATCH] Update net.py This change avoid the unbearable error related to "utf codec can't decode". --- pythonwhois/net.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pythonwhois/net.py b/pythonwhois/net.py index 53f87ba..8ee1a9f 100644 --- a/pythonwhois/net.py +++ b/pythonwhois/net.py @@ -91,4 +91,9 @@ def whois_request(domain, server, port=43): if len(data) == 0: break buff += data - return buff.decode("utf-8") + try: + d = buff.decode("utf-8") + except UnicodeDecodeError: + d = buff.decode("latin-1") + + return d