From 7162e40d2e92d82b9032f3ad7323af93eb84c2ea Mon Sep 17 00:00:00 2001 From: cokeBeer Date: Tue, 27 Sep 2022 18:44:18 +0800 Subject: [PATCH] fix csv encoding problem --- common/utils.py | 2 ++ export.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/common/utils.py b/common/utils.py index 38a14400..35a3228d 100644 --- a/common/utils.py +++ b/common/utils.py @@ -330,6 +330,8 @@ def export_all_results(path, name, fmt, datas): row_list.append(Record(keys, values)) rows = RecordCollection(iter(row_list)) content = rows.export(fmt) + if fmt == 'csv': + content = '\ufeff' + content save_to_file(path, content) diff --git a/export.py b/export.py index 62c34918..4000b554 100644 --- a/export.py +++ b/export.py @@ -60,6 +60,8 @@ def do_export(fmt, path, rows, show, domain, target): if show: print(rows.dataset) data = rows.export(fmt) + if fmt == 'csv': + data = '\ufeff' + data utils.save_to_file(path, data) logger.log('ALERT', f'The subdomain result for {domain}: {path}') data = rows.as_dict()