changeset 2af2499c4f12 in tryton:default
details: https://hg.tryton.org/tryton?cmd=changeset&node=2af2499c4f12
description:
        Default CSV encoding to UTF8 with BOM

        issue10769
        review362701002
diffstat:

 CHANGELOG                       |  1 +
 tryton/gui/window/win_csv.py    |  3 +--
 tryton/gui/window/win_export.py |  2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 2560dc0b5864 -r 2af2499c4f12 CHANGELOG
--- a/CHANGELOG Thu Feb 03 11:55:01 2022 +0100
+++ b/CHANGELOG Thu Feb 03 15:42:29 2022 +0100
@@ -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 -r 2560dc0b5864 -r 2af2499c4f12 tryton/gui/window/win_csv.py
--- a/tryton/gui/window/win_csv.py      Thu Feb 03 11:55:01 2022 +0100
+++ b/tryton/gui/window/win_csv.py      Thu Feb 03 15:42:29 2022 +0100
@@ -161,8 +161,7 @@
         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 -r 2560dc0b5864 -r 2af2499c4f12 tryton/gui/window/win_export.py
--- a/tryton/gui/window/win_export.py   Thu Feb 03 11:55:01 2022 +0100
+++ b/tryton/gui/window/win_export.py   Thu Feb 03 15:42:29 2022 +0100
@@ -383,7 +383,7 @@
         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:

Reply via email to