elceef / dnstwist

Domain name permutation engine for detecting homograph phishing attacks, typo squatting, and brand impersonation
https://dnstwist.it
Apache License 2.0
4.81k stars 764 forks source link

UnicodeEncodeError #80

Closed PhillHenry closed 4 years ago

PhillHenry commented 5 years ago

Running on Ubuntu 16.04, I was getting:

Traceback (most recent call last):
  File "dnstwist.py", line 1009, in <module>
    main()
  File "dnstwist.py", line 1003, in main
    p_cli(generate_cli(domains))
  File "dnstwist.py", line 120, in p_cli
    sys.stdout.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u1ecf' in position 2994: ordinal not in range(128)

I fixed it with the attached patch.

dnstwist.py.patch.txt

elceef commented 5 years ago

Your patch makes the code incompatible with Python3 as sys.stdout.write() accepts type str() while data.encode('utf8') make it type bytes(). Could you please ensure your terminal supports UTF8?

PhillHenry commented 5 years ago

Yes, my terminal supports UTF-8 and that encoding is clicked.

elceef commented 5 years ago

Which Python version do you use?

PhillHenry commented 5 years ago

$ python --version Python 2.7.12

elceef commented 5 years ago

Could you please check it with Python 3.6 or newer?

elceef commented 4 years ago

Python 3.6 or newer is required. Backward compatibility with Python 2.x has been abandoned almost a year ago. Closing this one.