Try utf-16 if utf-8 fails
This commit is contained in:
parent
ecde215ef1
commit
e44dbbf248
@ -101,9 +101,15 @@ def process_files(z) -> (ConfigParser, ConfigParser, list):
|
|||||||
mods = check_for_mods(z.open(filename))
|
mods = check_for_mods(z.open(filename))
|
||||||
elif 'DinoExport' in filename:
|
elif 'DinoExport' in filename:
|
||||||
# Get the contents of all DinoExport_*.ini files loaded into a dict
|
# Get the contents of all DinoExport_*.ini files loaded into a dict
|
||||||
dino_data[filename] = process_file(z.open(filename), 'dino.ini')
|
try:
|
||||||
if not dino_data[filename]:
|
dino_data[filename] = process_file(z.open(filename, encoding='utf-8'), 'dino.ini', 'utf-8')
|
||||||
return 0, 0, 0
|
except UnicodeDecodeError as e:
|
||||||
|
print(e)
|
||||||
|
try:
|
||||||
|
dino_data[filename] = process_file(z.open(filename, encoding='utf-16-le'), 'dino.ini', 'utf-16-le')
|
||||||
|
except UnicodeDecodeError as e:
|
||||||
|
print(e)
|
||||||
|
return 0, 0, 0
|
||||||
if not mods:
|
if not mods:
|
||||||
mods = check_for_modded_dinos(dino_data, mods)
|
mods = check_for_modded_dinos(dino_data, mods)
|
||||||
return game_config, dino_data, mods
|
return game_config, dino_data, mods
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user