From 12c77b485052713ce0676258770248715b145958 Mon Sep 17 00:00:00 2001 From: Jinx Date: Sun, 4 Feb 2024 14:20:10 +0800 Subject: [PATCH] Fixing the issue of garbled characters (Chinese characters) when opening the CSV export in Microsoft Excel. --- ihatemoney/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ihatemoney/utils.py b/ihatemoney/utils.py index 281cdf51..05bfb53e 100644 --- a/ihatemoney/utils.py +++ b/ihatemoney/utils.py @@ -196,7 +196,7 @@ def list_of_dicts2csv(dict_to_convert): writer = csv.writer(csv_file) writer.writerows(csv_data) csv_file.seek(0) - csv_file = BytesIO(csv_file.getvalue().encode("utf-8")) + csv_file = BytesIO(csv_file.getvalue().encode("utf-8-sig")) return csv_file