Bug 135847 - FILEOPEN: csv autoimport not consistent for 1>x>0 with german local
Summary: FILEOPEN: csv autoimport not consistent for 1>x>0 with german local
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.4.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CSV-Import
  Show dependency treegraph
 
Reported: 2020-08-17 15:27 UTC by Phillip Sz
Modified: 2021-09-21 10:26 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Test case csv (20 bytes, text/csv)
2020-08-17 15:28 UTC, Phillip Sz
Details
testcase2 (239 bytes, text/csv)
2020-08-17 20:06 UTC, Phillip Sz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phillip Sz 2020-08-17 15:27:00 UTC
Description:
Importing a csv dokument with default settings like:

aasd
0.234
0.625

will not import "0.", but only 234 and 625. However in the import dialog it is displayed correctly as "0.234" and 0.625

Steps to Reproduce:
1. open attached csv
2. click on "OK"
3.

Actual Results:
Values are imported as XXX, like 234 and 625

Expected Results:
Values should be imported as 0.XXX


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version: 6.4.4.2
Build-ID: 1:6.4.4-0ubuntu0.20.04.1
CPU-Threads: 8; BS: Linux 5.4; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
Calc: threaded
Comment 1 Phillip Sz 2020-08-17 15:28:22 UTC
Created attachment 164382 [details]
Test case csv
Comment 2 Ming Hua 2020-08-17 15:50:51 UTC
(In reply to Phillip Sz from comment #0)
> Additional Info:
> Version: 6.4.4.2
> Build-ID: 1:6.4.4-0ubuntu0.20.04.1
> CPU-Threads: 8; BS: Linux 5.4; UI-Render: Standard; VCL: gtk3; 
> Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
> Calc: threaded
German locale uses comma (,) as the decimal point symbol instead of period (.), and period (.) is used as separator in long numbers, such as 1.000.000.000 for a (US) billion.  So in your case values like 0.234 are intepreted as integer 0234 instead of 234/1000.

To import CSV files with period as decimal point, you probably need to change "Decimal separator key" to period in Tool > Options > Language Settings > Languages, and unselect "Same as locale setting".  Maybe there is a setting in the CSV import dialog, but my cursory search didn't find anything.
Comment 3 Phillip Sz 2020-08-17 20:04:27 UTC
(In reply to Ming Hua from comment #2)
> (In reply to Phillip Sz from comment #0)
> > Additional Info:
> > Version: 6.4.4.2
> > Build-ID: 1:6.4.4-0ubuntu0.20.04.1
> > CPU-Threads: 8; BS: Linux 5.4; UI-Render: Standard; VCL: gtk3; 
> > Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE
> > Calc: threaded
> German locale uses comma (,) as the decimal point symbol instead of period
> (.), and period (.) is used as separator in long numbers, such as
> 1.000.000.000 for a (US) billion.  So in your case values like 0.234 are
> intepreted as integer 0234 instead of 234/1000.
> 
> To import CSV files with period as decimal point, you probably need to
> change "Decimal separator key" to period in Tool > Options > Language
> Settings > Languages, and unselect "Same as locale setting".  Maybe there is
> a setting in the CSV import dialog, but my cursory search didn't find
> anything.

You are right, the german local is the problem and you can even change it in the import dialog.

However I notice some very strange behaviour. If I import the value "0.1234" and "0.12", it will be imported as string (I think? At least I can not add to it), even with a german local. Only if you have a number with three digits after the dot it will be imported as number 123. Also see testcase2.csv

I would propose to make it consistent for all cases.
Thanks!
Comment 4 Phillip Sz 2020-08-17 20:06:42 UTC
Created attachment 164387 [details]
testcase2
Comment 5 Jean-Baptiste Faure 2021-05-11 18:44:08 UTC
There is no problem to import these CSV test files. You do not need to change the decimal separator in Tools > Options > Language Settings > Languages. What you need to do is to select the right type of the column under Fields. In your case the correct type is "US English" that has the dot as decimal separator. After importing in Calc you will see all your numeric data interpreted as numbers (right aligned) with your local decimal separator.

So closing as WorksForMe. Please feel free to reopen if you disagree.

Best regards. JBF
Comment 6 August James 2021-09-21 10:26:33 UTC Comment hidden (spam)