Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: rows are wrongly read when first character is "n" #4149

Open
1 task done
simonesada opened this issue Jun 11, 2024 · 1 comment
Open
1 task done

[Bug]: rows are wrongly read when first character is "n" #4149

simonesada opened this issue Jun 11, 2024 · 1 comment
Labels

Comments

@simonesada
Copy link

Is the bug applicable and reproducable to the latest version of the package and hasn't it been reported before?

  • Yes, it's still reproducable

What version of Laravel Excel are you using?

3.1

What version of Laravel are you using?

11.10

What version of PHP are you using?

8.1

Describe your issue

When importing a csv file with some rows starting with the character "n" the library is not correctly reading the rows.
Sometimes the rows are merged in an unique string and other times the character "n" is removed from the string.
The imported file is in the correct format. The cells' delimiter is comma and the rows' delimiter is CRLF.

How can the issue be reproduced?

Importing a csv file with the content below:
test-import.csv

Dumping the $rows collection inside the collection method of the import class that implements ToColletion should return something like:

Illuminate\Support\Collection^ {#1461
  #items: array:2 [
    0 => Illuminate\Support\Collection^ {#1460
      #items: array:2 [
        "email" => "[email protected]"
        "gender" => "F"
      ]
      #escapeWhenCastingToString: false
    }
    1 => Illuminate\Support\Collection^ {#1474
      #items: array:2 [
        "email" => "[email protected]"
        "gender" => "M"
      ]
      #escapeWhenCastingToString: false
    }
  ]
  #escapeWhenCastingToString: false
}

As you can notice the characters "n" are totally removed from the first element's "email" string.

What should be the expected behaviour?

The collection method should inject a collection of $rows where each one corresponds to a single line of the file (and no more) and the string corresponding to the cells should be remain whole.

@simonesada simonesada added the bug label Jun 11, 2024
@patrickbrouwers
Copy link
Member

Think you'll have to try if it's reproducable with phpsoreadsheet csv reader directly, and if so, report it there, as we just call their csv reader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants