From 44080aa77a0e4e8bcc017fa9d2eba13d11d4e043 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Wed, 9 May 2018 15:21:30 -0800 Subject: [PATCH] Try utf-16 if utf-8 fails --- exts/imports/process_files.py | 4 ++-- exts/uploader.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exts/imports/process_files.py b/exts/imports/process_files.py index 5728385..3af6d70 100644 --- a/exts/imports/process_files.py +++ b/exts/imports/process_files.py @@ -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() diff --git a/exts/uploader.py b/exts/uploader.py index 05b8c7b..2c97796 100644 --- a/exts/uploader.py +++ b/exts/uploader.py @@ -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():