From 937dd579ccd1e1b82bae088ed7cc10883ee6bce5 Mon Sep 17 00:00:00 2001 From: Aleh Filipovich Date: Tue, 9 Sep 2014 14:42:07 +0200 Subject: [PATCH] Fixing #28 Unicode parsing problems --- pythonwhois/net.py | 2 +- test/data/bidtheatre.com | 104 ++++++++++++++++++++++++++ test/target_default/bidtheatre.com | 1 + test/target_normalized/bidtheatre.com | 1 + 4 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 test/data/bidtheatre.com create mode 100644 test/target_default/bidtheatre.com create mode 100644 test/target_normalized/bidtheatre.com diff --git a/pythonwhois/net.py b/pythonwhois/net.py index 53f87ba..8a962b8 100644 --- a/pythonwhois/net.py +++ b/pythonwhois/net.py @@ -91,4 +91,4 @@ def whois_request(domain, server, port=43): if len(data) == 0: break buff += data - return buff.decode("utf-8") + return buff.decode("utf-8", "replace") diff --git a/test/data/bidtheatre.com b/test/data/bidtheatre.com new file mode 100644 index 0000000..676f2ab --- /dev/null +++ b/test/data/bidtheatre.com @@ -0,0 +1,104 @@ +Whois Server v2.1.1 build 20140801151119 ADRS (C)2014 Active 24 ASA + +Domain Information +=================== +Domain.......: BIDTHEATRE.COM (DOM-469139) +Status.......: OK +Amended......: 2014-06-17 12:09:02 (CET/CEST) +Created......: 2012-11-01 14:44:09 (CET/CEST) +Expires......: 2014-11-01 14:44:09 (CET/CEST) +Registrar....: Loopia (REG-3) +DNSSec.......: No + +Organisation Contact +======================= +ID...........: ORG-516871 +Name.........: Big Oh AB +PostAddress..: Box 22201 +PostCode.....: 104 22 +PostArea.....: Stockholm +Country......: SE +Phone........: +46.708308163 +Fax..........: +Email........: marcus.johansson@gmail.com + +Administrative Contact +======================= +ID...........: UC-516872 +Name.........: Big Oh AB +PostAddress..: Box 22201 +PostCode.....: 104 22 +PostArea.....: Stockholm +Country......: SE +Phone........: +46.708308163 +Fax..........: +Email........: marcus.johansson@gmail.com + +Technical Contact +======================= +ID...........: UC-135071 +Name.........: Loopia AB +PostAddress..: Kopparbergsv�gen 8 +PostCode.....: 72213 +PostArea.....: V�ster�s +Country......: SE +Phone........: +46.21128222 +Fax..........: +46.21128233 +Email........: registry@loopia.se + +Billing Contact +======================= +ID...........: UC-135072 +Name.........: Loopia AB +PostAddress..: Kopparbergsv�gen 8 +PostCode.....: 72213 +PostArea.....: V�ster�s +Country......: SE +Phone........: +46.21128222 +Fax..........: +46.21128233 +Email........: registry@loopia.se + +Name Servers +======================= +ns1.digitalocean.com (NS-26957) +ns2.digitalocean.com (NS-26958) +ns3.digitalocean.com (NS-26959) + +Active 24 ASA as an accredited Registrar of generic top level domains, +has collected this information for the use of providing WHOIS services +according to the terms set in the Registrar Agreement by ICANN. +This information is provided to you for information purposes only and +is designed to assist persons in determining contents of a domain name +registration record in the Active 24 ASA database. Active 24 ASA makes +this information available to you "as is" and does not guarantee its +accuracy. By submitting a WHOIS query, you agree that you will use this +data only for lawful purposes and that, under no circumstances will you +use this data: (1) to allow, enable, or otherwise support the +transmission of mass unsolicited, commercial advertising or solicitations +via direct mail, electronic mail, or by telephone; (2) in contravention +of any applicable data and privacy protection acts; or (3) to enable high +volume, automated, electronic processes that apply to the registry +(or its systems). Compilation, repackaging, dissemination, or other use + of the WHOIS database in its entirety, or of a substantial portion +thereof, is not allowed without Active 24 ASA`s prior written permission. +Active 24 ASA reserves the right to modify or change these conditions at +any time without prior or subsequent notification of any kind. +By executing this query, in any manner whatsoever, you agree to abide by +these terms. + +NOTE: FAILURE TO LOCATE A RECORD IN THE WHOIS DATABASE IS NOT INDICATIVE +OF THE AVAILABILITY OF A DOMAIN NAME. + + +-- + Domain Name: BIDTHEATRE.COM + Registrar: ACTIVE 24 AS + Whois Server: whois.active24.com + Referral URL: http://www.active24.com + Name Server: NS1.DIGITALOCEAN.COM + Name Server: NS2.DIGITALOCEAN.COM + Name Server: NS3.DIGITALOCEAN.COM + Status: ok + Updated Date: 17-jun-2014 + Creation Date: 01-nov-2012 + Expiration Date: 01-nov-2014 diff --git a/test/target_default/bidtheatre.com b/test/target_default/bidtheatre.com new file mode 100644 index 0000000..249b0a2 --- /dev/null +++ b/test/target_default/bidtheatre.com @@ -0,0 +1 @@ +{"updated_date": ["2014-06-17T00:00:00"], "status": ["ok"], "contacts": {"admin": null, "tech": null, "registrant": null, "billing": null}, "nameservers": ["=======================", "ns1.digitalocean.com", "ns2.digitalocean.com", "ns3.digitalocean.com"], "expiration_date": ["2014-11-01T14:44:09"], "creation_date": ["2012-11-01T14:44:09"], "raw": ["Whois Server v2.1.1 build 20140801151119 ADRS (C)2014 Active 24 ASA\n\nDomain Information\n===================\nDomain.......: BIDTHEATRE.COM (DOM-469139)\nStatus.......: OK\nAmended......: 2014-06-17 12:09:02 (CET/CEST)\nCreated......: 2012-11-01 14:44:09 (CET/CEST)\nExpires......: 2014-11-01 14:44:09 (CET/CEST)\nRegistrar....: Loopia (REG-3)\nDNSSec.......: No\n\nOrganisation Contact\n=======================\nID...........: ORG-516871\nName.........: Big Oh AB\nPostAddress..: Box 22201\nPostCode.....: 104 22\nPostArea.....: Stockholm\nCountry......: SE\nPhone........: +46.708308163\nFax..........: \nEmail........: marcus.johansson@gmail.com\n\nAdministrative Contact\n=======================\nID...........: UC-516872\nName.........: Big Oh AB\nPostAddress..: Box 22201\nPostCode.....: 104 22\nPostArea.....: Stockholm\nCountry......: SE\nPhone........: +46.708308163\nFax..........: \nEmail........: marcus.johansson@gmail.com\n\nTechnical Contact\n=======================\nID...........: UC-135071\nName.........: Loopia AB\nPostAddress..: Kopparbergsv\ufffdgen 8\nPostCode.....: 72213\nPostArea.....: V\ufffdster\ufffds\nCountry......: SE\nPhone........: +46.21128222\nFax..........: +46.21128233\nEmail........: registry@loopia.se\n\nBilling Contact\n=======================\nID...........: UC-135072\nName.........: Loopia AB\nPostAddress..: Kopparbergsv\ufffdgen 8\nPostCode.....: 72213\nPostArea.....: V\ufffdster\ufffds\nCountry......: SE\nPhone........: +46.21128222\nFax..........: +46.21128233\nEmail........: registry@loopia.se\n\nName Servers\n=======================\nns1.digitalocean.com (NS-26957)\nns2.digitalocean.com (NS-26958)\nns3.digitalocean.com (NS-26959)\n\nActive 24 ASA as an accredited Registrar of generic top level domains,\nhas collected this information for the use of providing WHOIS services\naccording to the terms set in the Registrar Agreement by ICANN.\nThis information is provided to you for information purposes only and\nis designed to assist persons in determining contents of a domain name\nregistration record in the Active 24 ASA database. Active 24 ASA makes\nthis information available to you \"as is\" and does not guarantee its\naccuracy. By submitting a WHOIS query, you agree that you will use this\ndata only for lawful purposes and that, under no circumstances will you\nuse this data: (1) to allow, enable, or otherwise support the\ntransmission of mass unsolicited, commercial advertising or solicitations\nvia direct mail, electronic mail, or by telephone; (2) in contravention\nof any applicable data and privacy protection acts; or (3) to enable high\nvolume, automated, electronic processes that apply to the registry\n(or its systems). Compilation, repackaging, dissemination, or other use\n of the WHOIS database in its entirety, or of a substantial portion\nthereof, is not allowed without Active 24 ASA`s prior written permission.\nActive 24 ASA reserves the right to modify or change these conditions at\nany time without prior or subsequent notification of any kind.\nBy executing this query, in any manner whatsoever, you agree to abide by\nthese terms.\n\nNOTE: FAILURE TO LOCATE A RECORD IN THE WHOIS DATABASE IS NOT INDICATIVE\nOF THE AVAILABILITY OF A DOMAIN NAME.\n\n", " Domain Name: BIDTHEATRE.COM\n Registrar: ACTIVE 24 AS\n Whois Server: whois.active24.com\n Referral URL: http://www.active24.com\n Name Server: NS1.DIGITALOCEAN.COM\n Name Server: NS2.DIGITALOCEAN.COM\n Name Server: NS3.DIGITALOCEAN.COM\n Status: ok\n Updated Date: 17-jun-2014\n Creation Date: 01-nov-2012\n Expiration Date: 01-nov-2014\n"], "whois_server": ["whois.active24.com"], "registrar": ["ACTIVE 24 AS"], "emails": ["marcus.johansson@gmail.com", "registry@loopia.se"]} \ No newline at end of file diff --git a/test/target_normalized/bidtheatre.com b/test/target_normalized/bidtheatre.com new file mode 100644 index 0000000..2d48589 --- /dev/null +++ b/test/target_normalized/bidtheatre.com @@ -0,0 +1 @@ +{"updated_date": ["2014-06-17T00:00:00"], "status": ["ok"], "contacts": {"admin": null, "tech": null, "registrant": null, "billing": null}, "nameservers": ["=======================", "ns1.digitalocean.com", "ns2.digitalocean.com", "ns3.digitalocean.com"], "expiration_date": ["2014-11-01T14:44:09"], "creation_date": ["2012-11-01T14:44:09"], "raw": ["Whois Server v2.1.1 build 20140801151119 ADRS (C)2014 Active 24 ASA\n\nDomain Information\n===================\nDomain.......: BIDTHEATRE.COM (DOM-469139)\nStatus.......: OK\nAmended......: 2014-06-17 12:09:02 (CET/CEST)\nCreated......: 2012-11-01 14:44:09 (CET/CEST)\nExpires......: 2014-11-01 14:44:09 (CET/CEST)\nRegistrar....: Loopia (REG-3)\nDNSSec.......: No\n\nOrganisation Contact\n=======================\nID...........: ORG-516871\nName.........: Big Oh AB\nPostAddress..: Box 22201\nPostCode.....: 104 22\nPostArea.....: Stockholm\nCountry......: SE\nPhone........: +46.708308163\nFax..........: \nEmail........: marcus.johansson@gmail.com\n\nAdministrative Contact\n=======================\nID...........: UC-516872\nName.........: Big Oh AB\nPostAddress..: Box 22201\nPostCode.....: 104 22\nPostArea.....: Stockholm\nCountry......: SE\nPhone........: +46.708308163\nFax..........: \nEmail........: marcus.johansson@gmail.com\n\nTechnical Contact\n=======================\nID...........: UC-135071\nName.........: Loopia AB\nPostAddress..: Kopparbergsv\ufffdgen 8\nPostCode.....: 72213\nPostArea.....: V\ufffdster\ufffds\nCountry......: SE\nPhone........: +46.21128222\nFax..........: +46.21128233\nEmail........: registry@loopia.se\n\nBilling Contact\n=======================\nID...........: UC-135072\nName.........: Loopia AB\nPostAddress..: Kopparbergsv\ufffdgen 8\nPostCode.....: 72213\nPostArea.....: V\ufffdster\ufffds\nCountry......: SE\nPhone........: +46.21128222\nFax..........: +46.21128233\nEmail........: registry@loopia.se\n\nName Servers\n=======================\nns1.digitalocean.com (NS-26957)\nns2.digitalocean.com (NS-26958)\nns3.digitalocean.com (NS-26959)\n\nActive 24 ASA as an accredited Registrar of generic top level domains,\nhas collected this information for the use of providing WHOIS services\naccording to the terms set in the Registrar Agreement by ICANN.\nThis information is provided to you for information purposes only and\nis designed to assist persons in determining contents of a domain name\nregistration record in the Active 24 ASA database. Active 24 ASA makes\nthis information available to you \"as is\" and does not guarantee its\naccuracy. By submitting a WHOIS query, you agree that you will use this\ndata only for lawful purposes and that, under no circumstances will you\nuse this data: (1) to allow, enable, or otherwise support the\ntransmission of mass unsolicited, commercial advertising or solicitations\nvia direct mail, electronic mail, or by telephone; (2) in contravention\nof any applicable data and privacy protection acts; or (3) to enable high\nvolume, automated, electronic processes that apply to the registry\n(or its systems). Compilation, repackaging, dissemination, or other use\n of the WHOIS database in its entirety, or of a substantial portion\nthereof, is not allowed without Active 24 ASA`s prior written permission.\nActive 24 ASA reserves the right to modify or change these conditions at\nany time without prior or subsequent notification of any kind.\nBy executing this query, in any manner whatsoever, you agree to abide by\nthese terms.\n\nNOTE: FAILURE TO LOCATE A RECORD IN THE WHOIS DATABASE IS NOT INDICATIVE\nOF THE AVAILABILITY OF A DOMAIN NAME.\n\n", " Domain Name: BIDTHEATRE.COM\n Registrar: ACTIVE 24 AS\n Whois Server: whois.active24.com\n Referral URL: http://www.active24.com\n Name Server: NS1.DIGITALOCEAN.COM\n Name Server: NS2.DIGITALOCEAN.COM\n Name Server: NS3.DIGITALOCEAN.COM\n Status: ok\n Updated Date: 17-jun-2014\n Creation Date: 01-nov-2012\n Expiration Date: 01-nov-2014\n"], "whois_server": ["whois.active24.com"], "registrar": ["Active 24 AS"], "emails": ["marcus.johansson@gmail.com", "registry@loopia.se"]} \ No newline at end of file