PhpSpreadsheet/tests/data/Reader/CSV
oleibman 7517cdd008
Improve Coverage for CSV (#1475)
I believe that both CSV Reader and Writer are 100% covered now.

There were some errors uncovered during development.

The reader specifically permits encodings other than UTF-8 to be used.
However, fgetcsv will not properly handle other encodings.
I tried replacing it with fgets/iconv/strgetcsv, but that could not
handle line breaks within a cell, even for UTF-8.
This is, I'm sure, a very rare use case.
I eventually handled it by using php://memory to hold the translated
file contents for non-UTF8. There were no tests for this situation,
and now there are (probably too many).

"Contiguous" read was not handle correctly. There is a file
in samples which uses it. It was designed to read a large sheet,
and split it into three. The first sheet was corrrect, but the
second and third were almost entirely empty. This has been corrected,
and the sample code was adapted into a formal test with assertions
to confirm that it works as designed.

I made a minor documentation change. Unlike HTML, where you never
need a BOM because you can declare the encoding in the file,
a CSV with non-ASCII characters must explicitly include a BOM
for Excel to handle it correctly. This was explained in the Reading CSV
section, but was glossed over in the Writing CSV section, which I
have updated.
2020-05-17 18:15:18 +09:00
..
backslash.csv Allow CSV escape character to be set 2018-05-23 10:31:41 +09:00
contains_html.csv Could not open CSV file containing HTML fragment 2018-06-25 11:12:27 +09:00
csv_without_extension Could not open CSV file containing HTML fragment 2018-06-25 11:12:27 +09:00
empty.csv Check for MIME type to know if CSV reader can read a file 2018-02-05 21:33:23 +09:00
enclosure.csv Better auto-detection of CSV separators 2017-12-28 12:25:37 +09:00
encoding.iso88591.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf8.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf8bom.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf16be.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf16le.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf32be.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
encoding.utf32le.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
line_break_in_enclosure.csv Fix CSV delimiter detection on line breaks 2018-10-21 18:23:55 +11:00
line_break_in_enclosure_with_escaped_quotes.csv Ignore escaped enclosures within an enclosure when inferring csv separator (#906) 2019-02-25 23:20:50 +01:00
no_delimiter.csv Csv reader avoid notice when the file is empty 2018-10-28 14:16:53 +11:00
semicolon_separated.csv Infer CSV delimiter if it hasn't been set explicitly 2017-04-20 17:02:03 +09:00
sep.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
utf16be.line_break_in_enclosure.csv Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00