Bug 153457

Summary: loading and saving CSV in calc does not round-trip because numbers get converted to the locale's decimal separator
Product: LibreOffice Reporter: Lionel Elie Mamane <lionel>
Component: CalcAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: buzea.bogdan, erack, mmokrejs
Priority: medium    
Version: 7.4.4.2 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=152336
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 109236    
Attachments: Example of original CSV file (with dot as decimal separator)
CSV file saved by LibreOffice

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.