Bug 153457 - loading and saving CSV in calc does not round-trip because numbers get converted to the locale's decimal separator
Summary: loading and saving CSV in calc does not round-trip because numbers get conver...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CSV-Import
  Show dependency treegraph
 
Reported: 2023-02-08 06:37 UTC by Lionel Elie Mamane
Modified: 2024-04-20 09:21 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example of original CSV file (with dot as decimal separator) (29 bytes, text/csv)
2023-02-08 06:38 UTC, Lionel Elie Mamane
Details
CSV file saved by LibreOffice (31 bytes, text/csv)
2023-02-08 06:38 UTC, Lionel Elie Mamane
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2023-02-08 06:37:16 UTC
Description:
LibreOffice is not a good CSV editor because it effectively corrupts the CSV-based file format by switching the numbers to the locale's decimal separator on save.

Steps to Reproduce:
1. Set locale to one that uses comma as decimal separator
2. Make sure LibreOffice is closed so that it is restarted in the above locale
3. Open a CSV file containing numbers with dot as decimal separator
4. Save (CTRL+S or Menu File / Save or the floppy disk icon)

Actual Results:
The CSV file is not the same anymore; the numbers are written out with comma as decimal separator.

Expected Results:
The CSV file should be effectively unchanged, using the same variant of the CSV file format: same separator between fields (columns), same decimal separator within numbers, same text encoding, ...

If the original CSV was not fully internally consistent (such as non-uniform application of quoting of fields), it is OK to canonicalise this.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.4.4.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: fr-LU (fr_LU.UTF-8); UI: en-GB
Debian package version: 1:7.4.4-3
Calc: threaded
Comment 1 Lionel Elie Mamane 2023-02-08 06:38:09 UTC
Created attachment 185195 [details]
Example of original CSV file (with dot as decimal separator)
Comment 2 Lionel Elie Mamane 2023-02-08 06:38:27 UTC
Created attachment 185196 [details]
CSV file saved by LibreOffice
Comment 3 Mike Kaganski 2023-02-08 07:49:19 UTC
Agree.
IMO, CSV import should set the locale of the data to the value used in the import dialog. Maybe by setting corresponding changes in the default cell format. I don't recall any other "document-wide locale" setting.