Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maybe a better way to fix decoding issues. Fix #51. #64

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pythonwhois/net.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import socket, re, sys
from codecs import encode, decode
from . import shared
import cchardet

def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=False, with_server_list=False, server_list=None):
previous = previous or []
Expand Down Expand Up @@ -104,4 +105,5 @@ def whois_request(domain, server, port=43):
if len(data) == 0:
break
buff += data
return buff.decode("utf-8", "replace")
encoding = cchardet.detect(buff)['encoding']
return buff.decode(encoding)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
envlist = py26,py27,py33

[testenv]
deps = cchardet
usedevelop = True
setenv = VIRTUAL_ENV={envdir}
commands = python test.py run all