Bug Hunting Session
Bug 106678 - CSV Filter Option for quoting everything is ignored
Summary: CSV Filter Option for quoting everything is ignored
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
5.2.6.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0
Keywords:
Depends on:
Blocks: CSV-Dialog
  Show dependency treegraph
 
Reported: 2017-03-21 15:30 UTC by Andy
Modified: 2019-02-13 04:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with Makro that will export 2 CSV to /tmp/ (14.31 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-12-15 22:59 UTC, Andy Pillip
Details
a fixed test case (10.74 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-12-25 09:30 UTC, Takeshi Abe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy 2017-03-21 15:30:57 UTC
To me it seems like a bug, `document.StoreToURL` will ignore the 8th filter option for CSV.

Unfortunately the interface to export CSV is not well designed in that there's no real function call for it, but only `document.StoreToURL` along with arguments in a certain, undocumented order.

So I'm not quite sure about the intended behaviour.

I found OpenOffice's Documentation of Filter Options, but I'm not sure if it applies to LibreOffice. There seems to be nothing in the wiki.
https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Token_8.2C_csv_export

Anyway, it states:

> Token 8, csv export
> 
> This token has no UI equivalent. If true, the number cells are stored as numbers. If false, the numbers are stored as text, with text delimiters.
> 
> String, either false or true. Default value : true.

So using it should quote every single cell, which is not the case.

I asked abouth this on Ask LibreOffice, with no answer. There you can find an example to verify.
https://ask.libreoffice.org/en/question/89829/force-all-quotes-on-csv-export-which-filter-option/

I'm on Fedora 25.
My Build-ID: 5.2.6.2-4.fc25

CPU-Threads: 4; BS-Version: Linux 4.8; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.utf8); Calc: group

Thanks for checking.
Comment 1 Xisco Faulí 2017-12-14 09:13:05 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 Andy Pillip 2017-12-15 22:59:41 UTC
Created attachment 138470 [details]
Spreadsheet with Makro that will export 2 CSV to /tmp/

Voilà, I uploaded a test spreadsheet with a piece of Makro code.

There is text fields and number fields. The makro will export one CSV with parameter 8=false, and one with 8=true.

You'll see that there is no difference in the exported CSV files.

If you're not on a Unix system, you might need to adjust the path. Currently it's /tmp/. 

Thanks for checking.
Comment 3 Buovjaga 2017-12-16 13:13:09 UTC
Reproduced.

Arch Linux 64-bit
Version: 6.1.0.0.alpha0+
Build ID: 1390c91c7584a89298906849cdabae131f8a6191
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group threaded
Built on December 14th 2017
Comment 4 QA Administrators 2018-12-17 03:41:32 UTC Comment hidden (obsolete)
Comment 5 Andy 2018-12-17 13:20:16 UTC
I just ran the demo macro with my latest lo, and the bug persists.

Version: 6.1.2.1
Build-ID: 6.1.2.1-3.fc29
CPU-Threads: 4; BS: Linux 4.19; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.UTF-8); Calc: group threaded

Thanks very much for looking into that some when.
Comment 9 Takeshi Abe 2018-12-25 09:30:52 UTC
Created attachment 147811 [details]
a fixed test case

Found that LibO's CSV filter had not handled the 8th token ever.
I have implemented the feature described in
<https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Token_8.2C_csv_export>
and submitted the patch for review:
<https://gerrit.libreoffice.org/#/c/65604/>

Besides, I also found that the test macro attached by Andy
has a flaw which has not Join()'ed 8th token into Propval(1).
Attached an ods with a fixed macro, in which the option
"save cell as shown" (9th token) is given false, because my
implementation makes the true value of the 9th token take
priority over the false value of the 8th.
Comment 10 Commit Notification 2019-01-16 16:45:14 UTC
Takeshi Abe committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/86501f577638b44042c35e601d13651992b64fd5%5E%21

tdf#106678 Implement CSV filter option's 8th token

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.