https://bugs.documentfoundation.org/show_bug.cgi?id=153055

Mike Kaganski <mikekagan...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |NOTABUG

--- Comment #1 from Mike Kaganski <mikekagan...@hotmail.com> ---
This is not a bug.

(In reply to eduardomozart182 from comment #0)
> I'd imported a CSV file to LibreOffice with the following line:
> 
> "MSSQL 2017 - Qualitor - Usuário ""qualitor""","R
> Networks",Teampass,,qualitor,Qualitor!@#,"Usu?rio interno da inst?ncia
> \"MSSQLSERVER\" do MSSQL 2017 (server02), utilizado para conex?o da
> aplica??o Qualitor Web ao banco de dados do Qualitor. Para autentica??o ao
> banco de dados do Qualitor, ? necess?rio usar os usu?rios de dom?nio
> \"eduardo.mozart\", \"roberto.oliveira\" ou \"Administrator\"."
> 
> 
> Steps to Reproduce:
> 1. I opened it with LibreOffice only with the "Separated by" 'Comma'
> selected. It loads and shows up into the right columns as expected.

No, it doesn't load "as expected", because if you inspect it carefully, the
following piece goes into column H (i.e., into the next cell):

 \"roberto.oliveira\" ou \"Administrator\"."

and the cell in column G ends with

\"eduardo.mozart\

And this is the correct behavior. If you look at the first field in the CSV, it
looks like

"MSSQL 2017 - Qualitor - Usuário ""qualitor"""

and appears in Calc as

MSSQL 2017 - Qualitor - Usuário "qualitor"

The quotations work as expected, according to the CSV specification RFC 4180
[1]:

> 7.  If double-quotes are used to enclose fields, then a double-quote
>     appearing inside a field must be escaped by preceding it with
>     another double quote.  For example:
> 
>     "aaa","b""bb","ccc"

Note: to escape the double-quote character, you use *another double-quote
character*!

Now look at the 7th field (as one *could* expect):

"Usu?rio interno da inst?ncia \"MSSQLSERVER\" do MSSQL 2017 (server02),
utilizado para conex?o da aplica??o Qualitor Web ao banco de dados do Qualitor.
Para autentica??o ao banco de dados do Qualitor, ? necess?rio usar os usu?rios
de dom?nio \"eduardo.mozart\", \"roberto.oliveira\" ou \"Administrator\"."

It starts and ends with a double-quote; and all internal double-quotes *must*
be escaped using another double-quote. But they are not. Instead, backslash is
used for that - which is wrong. And when parsing such a field, Calc finds an
*unescaped* double-quote, immediately followed by proper field delimiter
(comma), which happens after eduardo.mozart\; Calc correctly ends the field
here, and starts another field - which gets the rest.

And then, it outputs this to the file according to your specifications; the
field delimiter changes to semicolon, and it's used to separate 7th and 8th
fields.

[1] https://www.rfc-editor.org/rfc/rfc4180

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to