Skip to content

CSV delimiter counting can't handle line breaks inside an enclosure #716

Closed
@thisispaul

Description

This is:

- [X] a bug report

What is the expected behavior?

When counting delimiters of a CSV that has text with line breaks inside an enclosure it should not count the lines inside the enclosure as separate lines when calculating its deviation.

What is the current behavior?

If you have a file like Delimiter Test.txt which has line breaks in it. It incorrectly determines the delimiter as " " and not ",".

What are the steps to reproduce?

Parse this CSV

Name,Copy,URL
Test,"This is a test
this is a test
with line breaks
that breaks the
delimiters",http://google.com
Test,"This is a test
this is a test
with line breaks
that breaks the
delimiters",http://google.com
Test,"This is a test
this is a test
with line breaks
that breaks the
delimiters",http://google.com
Test,"This is a test
this is a test
with line breaks
that breaks the
delimiters",http://google.com

Then it determines the delimiter as a space and not a comma.

Which versions of PhpSpreadsheet and PHP are affected?

PhpSpreadsheet - 1.4.1
PHP - 7.2

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions