Try utf-16 if utf-8 fails
This commit is contained in:
parent
1c3e207f5d
commit
44080aa77a
@ -51,10 +51,10 @@ def process_file(in_file, file_type) -> ConfigParser:
|
||||
keep_blocks = bot_config['keep_blocks'][file_type]
|
||||
lines = in_file.readlines()
|
||||
try:
|
||||
data = [line.decode('utf-8') for line in lines]
|
||||
data = [line.decode(encoding='utf-8') for line in lines]
|
||||
except UnicodeDecodeError:
|
||||
try:
|
||||
data = [line.decode('utf-16') for line in lines]
|
||||
data = [line.decode(encoding='utf-16') for line in lines]
|
||||
except UnicodeDecodeError:
|
||||
return 0
|
||||
clean_data = list()
|
||||
|
||||
@ -25,7 +25,7 @@ class Uploader:
|
||||
unzipped = process_files.load_zip(file)
|
||||
game_ini, dinos_data, mods = process_files.process_files(unzipped)
|
||||
if not game_ini and not dinos_data and not mods:
|
||||
await msg.edit(content='There was an encoding error with one of the files provided'
|
||||
await msg.edit(content='There was an encoding error with one of the files provided '
|
||||
'and they cannot be processed')
|
||||
return
|
||||
if dinos_data == dict():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user