Skip to content
Open
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
20 changes: 10 additions & 10 deletions modules/impact/wildcards.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,11 @@ def get_wildcard_value(key):
def load_txt_wildcard(file_path):
"""Load a .txt wildcard file"""
try:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
with open(file_path, 'r', encoding="UTF-8") as f:
lines = f.read().splitlines()
return [x for x in lines if x.strip() and not x.strip().startswith('#')]
except (yaml.reader.ReaderError, UnicodeDecodeError):
with open(file_path, 'r', encoding="UTF-8", errors="ignore") as f:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
lines = f.read().splitlines()
return [x for x in lines if x.strip() and not x.strip().startswith('#')]

Expand All @@ -374,10 +374,10 @@ def load_yaml_wildcard(file_path, key_prefix=''):
global loaded_wildcards

try:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
with open(file_path, 'r', encoding="UTF-8") as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)
except (yaml.reader.ReaderError, UnicodeDecodeError):
with open(file_path, 'r', encoding="UTF-8", errors="ignore") as f:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)

if not yaml_data:
Expand Down Expand Up @@ -480,11 +480,11 @@ def read_wildcard_dict(wildcard_path, on_demand=False):
else:
# Load data immediately (original behavior)
try:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
with open(file_path, 'r', encoding="UTF-8") as f:
lines = f.read().splitlines()
wildcard_dict[key] = [x for x in lines if x.strip() and not x.strip().startswith('#')]
except yaml.reader.ReaderError:
with open(file_path, 'r', encoding="UTF-8", errors="ignore") as f:
except (yaml.reader.ReaderError, UnicodeDecodeError):
with open(file_path, 'r', encoding="ISO-8859-1") as f:
lines = f.read().splitlines()
wildcard_dict[key] = [x for x in lines if x.strip() and not x.strip().startswith('#')]
elif file.endswith('.yaml') or file.endswith('.yml'):
Expand All @@ -501,10 +501,10 @@ def read_wildcard_dict(wildcard_path, on_demand=False):
else:
# Load data immediately (original behavior)
try:
with open(file_path, 'r', encoding="ISO-8859-1") as f:
with open(file_path, 'r', encoding="UTF-8") as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)
except yaml.reader.ReaderError:
with open(file_path, 'r', encoding="UTF-8", errors="ignore") as f:
except (yaml.reader.ReaderError, UnicodeDecodeError):
with open(file_path, 'r', encoding="ISO-8859-1") as f:
yaml_data = yaml.load(f, Loader=yaml.FullLoader)

for k, v in yaml_data.items():
Expand Down