MPCodeWriter21 / whois21

whois21 is a simple and easy to use python package that lets you easily query whois information of a domain/IP.
Apache License 2.0
26 stars 1 forks source link

Whois problem with non utf-8 characters. #2

Closed ghost closed 1 year ago

ghost commented 1 year ago

Whois' request for this IP gives the following error. I am guessing that the reason for this error is related that the whois record contains French characters (8 rue de la ville l'évêque).

whois = whois21.WHOIS("62.4.13.111") Traceback (most recent call last): File "", line 1, in File "C:\Users\Maciek\AppData\Roaming\Python\Python311\site-packages\whois21__init.py", line 173, in init self.whois(domain, servers, timeout, use_rdap, force_rdap) File "C:\Users\Maciek\AppData\Roaming\Python\Python311\site-packages\whois21\init.py", line 202, in whois self.whois() File "C:\Users\Maciek\AppData\Roaming\Python\Python311\site-packages\whois21__init.py", line 267, in whois self.call_whois_servers() File "C:\Users\Maciek\AppData\Roaming\Python\Python311\site-packages\whois21\init.py", line 425, in call_whois_servers lines = self.__raw.decode('utf-8').split('\n') ^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 882: invalid continuation byte

MPCodeWriter21 commented 1 year ago

Hello @haps-basset, thank you for your report regarding the issue with the encoding of the whois record.

I have just published a new version of the package (v1.3.0) which has options for customizing the way the whois record is decoded and also tries to detect the encoding automatically. It should fix the issue you reported. Please let me know if you have any other problems with the package.

You can install the new version with pip:

pip install whois21==1.3.0

Best regards.

ghost commented 1 year ago

Many thanks