From a049e420bdcb77388ff1e5a7e41126df543013de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Thu, 3 Feb 2022 15:42:29 +0100 Subject: [PATCH] Default CSV encoding to UTF8 with BOM issue10769 review362701002 --- CHANGELOG | 1 + tryton/gui/window/win_csv.py | 3 +-- tryton/gui/window/win_export.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 665861bdca..9b86301c0d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Default CSV encoding to UTF8 with BOM * Display the number of selected records * Humanize the count result * Add limit to search_count diff --git a/tryton/gui/window/win_csv.py b/tryton/gui/window/win_csv.py index f28d64dcd6..53517517b7 100644 --- a/tryton/gui/window/win_csv.py +++ b/tryton/gui/window/win_csv.py @@ -161,8 +161,7 @@ class WinCSV(NoModal): self.csv_enc = Gtk.ComboBoxText() for i, encoding in enumerate(encodings): self.csv_enc.append_text(encoding) - if ((os.name == 'nt' and encoding == 'cp1252') - or (os.name != 'nt' and encoding == 'utf_8')): + if encoding == 'utf_8_sig': self.csv_enc.set_active(i) label_csv_enc.set_mnemonic_widget(self.csv_enc) box.pack_start(self.csv_enc, expand=False, fill=True, padding=0) diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index 23476002ac..8750b9543b 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -383,7 +383,7 @@ class WinExport(WinCSV): self.destroy() def export_csv(self, fname, fields, data, paths, popup=True): - encoding = self.csv_enc.get_active_text() or 'UTF-8' + encoding = self.csv_enc.get_active_text() or 'utf_8_sig' locale_format = self.csv_locale.get_active() try: