Bug 119722 - Losing Dots when importing a CSV with IPv4 addresses
Summary: Losing Dots when importing a CSV with IPv4 addresses
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.5.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-06 11:41 UTC by Thomas Seeling
Modified: 2018-09-07 22:22 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
CSV file with IPv4 addresses (147 bytes, text/csv)
2018-09-06 11:41 UTC, Thomas Seeling
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Seeling 2018-09-06 11:41:48 UTC
Created attachment 144713 [details]
CSV file with IPv4 addresses

I have to work with CSV files quite often (reports generated from scripts). I noticed that LO has a serious problem with IPv4 addresses (IPs and subnet masks). Some IPs get imported as they should while others lose the dots. LO shouldn't change the data at all. When I look at the format menu the column is marked as "number" but obviously it cannot be a number if it contains 3 dots, so LO should autoformat as "Text".

See attached bugreport.csv. First line is ok, second and third not.

Open Dialog, select CSV file, select "semicolon" and leave other settings as default.

Works:
10.112.0.171

Does not work:
10111216147
10111216148

For now as a quick workaround my scripts generate CSV with quotes. The quotes get imported into the cells as well, so then I mark all columns as "Text" and do a global search+replace from " to <nothing> but this is quite ugly.
Comment 1 Eike Rathke 2018-09-06 12:13:33 UTC
(In reply to Thomas Seeling from comment #0)
> When I look at the format menu the column
> is marked as "number" but obviously it cannot be a number if it contains 3
> dots, so LO should autoformat as "Text".
Obviously it can be a number if your import locale uses a dot as group (aka thousands) separator, which is the case for de-DE German Germany, and the digits are grouped by 3. Select the column in question and choose type Text.
Comment 2 Thomas Seeling 2018-09-06 13:12:17 UTC
Then it's still inconsistent behaviour because I never wished nor configured for this. Can this autoformatting be switched off?
It's not a solution to set my locale to something else.
Is there a setting in the open dialog where I can switch it off?
The checkbox for "recognize special numbers" is not ticked.

The data is already destroyed before I even get the chance to format the column as "Text".

I'm not happy that this bug report has been closed so quickly. I can understand the explanation of "dots" as triplet separator for numbers but I'd like to have an option to ignore and not do any magic during import.
Comment 3 Alex Thurgood 2018-09-06 16:02:32 UTC
No repro for me with:
Version: 6.0.6.2
Build ID: 0c292870b25a325b5ed35f6b45599d2ea4458e77
Threads CPU : 8; OS : Mac OS X 10.13.6; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group

Drag and drop the CSV file to a running instance of LibreOffice.
The CSV import wizard opens.
Choose semi-colon as separator.
Default option of number recognition is active.
In the display in Calc, the IP column displays the correct results after import.
Comment 4 Alex Thurgood 2018-09-06 16:03:47 UTC
@Thomas : is this a distrib-provided version of LO, or did you install from the TDF download page ?
Comment 5 lightonflux 2018-09-06 19:05:11 UTC
Can confirm.

Version: 6.1.1.1 (via Debian Testing)
Build-ID: 1:6.1.1~rc1-2
CPU-Threads: 4; BS: Linux 4.17; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.utf8); Calc: group threaded

When importing as de-DE it breaks the second and third IP address. But when importing as en-GB everything is as expected.
Comment 6 lightonflux 2018-09-06 19:07:42 UTC
To clarify: When changing to en-GB in the import dialogue. The application was running as de-DE as with the first import.
Comment 7 V Stuart Foote 2018-09-07 00:37:21 UTC
(In reply to lightonflux from comment #5)
> Can confirm.
> 
> Version: 6.1.1.1 (via Debian Testing)
> Build-ID: 1:6.1.1~rc1-2
> CPU-Threads: 4; BS: Linux 4.17; UI-Render: Standard; VCL: gtk3; 
> Gebietsschema: de-DE (de_DE.utf8); Calc: group threaded
> 
> When importing as de-DE it breaks the second and third IP address. But when
> importing as en-GB everything is as expected.

That is not a "bug" confirmation rather, it is the CSV import filter correctly responding for a column with "Standard" logic to what is a valid number.

Correct usage is to change the field to Text as there is no other pattern recognition in Standard to hand IPv4 or IPv6 notation.  In other words, if the locale would make it a number--use the CSV import dialog to correct the column type!


=> NAB
Comment 8 V Stuart Foote 2018-09-07 00:43:21 UTC
A closing sidenote, yes it would be a feasible enhancement to implement filter(s) in the CSV import Standard mode to include IPv4 or IPv6 notation that overrides locale. But, issue here is clearly one of usage and is not a bug in the CSV import dialog.
Comment 9 Thomas Seeling 2018-09-07 08:58:48 UTC
Ok, I was not aware that I can change the column type in the import dialog. I can rightclick on my IPv4 column and change it to "Text". So the locale doesn't matter at all.

That works for me.
Thanks for your patience.
Comment 10 lightonflux 2018-09-07 19:20:04 UTC
Is a help text in order?

Some small text that tells the user that the columns below are interactive elements.

I think this is especially important for people with Excel experience. AFAIK in Excel it is only a preview. And it says so.
Comment 11 V Stuart Foote 2018-09-07 22:22:16 UTC
(In reply to lightonflux from comment #10)
> Is a help text in order?
> 
> Some small text that tells the user that the columns below are interactive
> elements.
> 

But the "Fields" and "Column type" preview panel has *always* been interactive (inherited from OOo) the current help (master/6.2) for the dialog is available here:

https://help.libreoffice.org/6.2/en-US/text/shared/00/00000208.html?System=WIN&DbPAR=CALC#bm_id3155934

Don't see much need for a "tool-tip" that a mouse over and context menu provides.

> I think this is especially important for people with Excel experience. AFAIK
> in Excel it is only a preview. And it says so.

No, Excel's Text Import Wizard also goes interactive, allowing to set General-Text-Date-or Skip, in its final steps.  The OOo/LibreOffice UI is much more direct.