Open files in mode utf8

This commit is contained in:
VirtuBox
2019-09-01 22:02:52 +02:00
parent 0ee116bd6c
commit 1e6d41d3d8
2 changed files with 3 additions and 2 deletions

View File

@@ -32,10 +32,11 @@ def GetDomainlevel(domain):
domain_name = domain.split('.')
if domain_name[0] == 'www':
domain_name = domain_name[1:]
domain_type = ''
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
# Read mode opens a file for reading only.
Suffix_file = open(
"/var/lib/wo/public_suffix_list.dat", "r")
"/var/lib/wo/public_suffix_list.dat", mode='rt', encoding='utf-8')
# Read all the lines into a list.
for domain_suffix in Suffix_file:
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):