From 0c9b342b4ba16bacfe99f3dc09b6c73e0ae8fce3 Mon Sep 17 00:00:00 2001 From: maxnth Date: Thu, 4 Apr 2024 10:59:17 +0200 Subject: [PATCH] get-codec: set encoding when writing csv --- pagetools/cli/analytics/get_codec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pagetools/cli/analytics/get_codec.py b/pagetools/cli/analytics/get_codec.py index f6e560b..ef34d4a 100644 --- a/pagetools/cli/analytics/get_codec.py +++ b/pagetools/cli/analytics/get_codec.py @@ -102,7 +102,7 @@ def serialize(codec: dict, output, out_format: str, freq: bool, text_output_newl elif out_format == "csv": header = ["character", "frequency"] - with open(output, "w") as outfile: + with open(output, "w", encoding="utf-8") as outfile: csv_writer = csv.writer(outfile, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL) csv_writer.writerow(header) for row in codec: