Menu

#2 Field value detection failure

v1.0_(example)
open
nobody
wont-fix (1)
5
2023-12-28
2023-12-28
No

The script apparently cannot detect the content of a field if the content is enclosed in double quotes and starts with a comma. An example pattern follows.

field1,", substring in field2",field3

Thanks in advance!

Andrea

Discussion

  • Benedikt Hallinger

    I can reproduce this, thanks for reporting.
    That is (from the code) expected behaviour and the only workaround currently is to avoid that combination.
    Or escape the comma after the quote: "\, and strip that afterwars using sed.

     
  • Benedikt Hallinger

    I think, currently this cannot be fixed because of the way split() works.
    Look at how the separation of a field is exactly the same syntax as the combination $quote$delim: its both ", in this case.

    field1,", substring in field2",field3
           ^^                    ^^
    

    This would need a major code overhaul, maybe by using Text::CSV. So probably cleaning the source data may be easier in your case.

     

    Last edit: Benedikt Hallinger 2023-12-28
  • Benedikt Hallinger

    • labels: --> wont-fix
     

Log in to post a comment.

MongoDB Logo MongoDB