diff --git a/tests/example_files/UTF-16LE_with_BOM_and_sep_row.csv b/tests/example_files/UTF-16LE_with_BOM_and_sep_row.csv new file mode 100644 index 0000000..f8d713b Binary files /dev/null and b/tests/example_files/UTF-16LE_with_BOM_and_sep_row.csv differ diff --git a/tests/example_files/UTF-8_with_BOM_and_sep_row.csv b/tests/example_files/UTF-8_with_BOM_and_sep_row.csv new file mode 100644 index 0000000..76bcaf9 --- /dev/null +++ b/tests/example_files/UTF-8_with_BOM_and_sep_row.csv @@ -0,0 +1,5 @@ +sep=; +title;isbn;publishedAt +Красивая кулинария;5454-5587-3210;21.05.2011 +The Wine Connoisseurs;2547-8548-2541;12.12.2011 +Weißwein;1313-4545-8875;23.02.2012 diff --git a/tests/methods/parse_test.php b/tests/methods/parse_test.php index 331bcd9..7652571 100644 --- a/tests/methods/parse_test.php +++ b/tests/methods/parse_test.php @@ -44,6 +44,16 @@ class parse_test extends PHPUnit\Framework\TestCase { $this->assertEquals($this->_get_magazines_data(), $this->csv->data); } + public function test_sep_row_auto_detection_UTF8() { + $this->csv->auto(__DIR__ . '/../example_files/UTF-8_with_BOM_and_sep_row.csv'); + $this->assertEquals($this->_get_magazines_data(), $this->csv->data); + } + + public function test_sep_row_auto_detection_UTF16() { + $this->csv->auto(__DIR__ . '/../example_files/UTF-16LE_with_BOM_and_sep_row.csv'); + $this->assertEquals($this->_get_magazines_data(), $this->csv->data); + } + public function test_single_column() { $this->csv->auto(__DIR__ . '/../example_files/single_column.csv'); $expected = [