shuchkin / simplecsv Goto Github PK
View Code? Open in Web Editor NEWParse and retrieve data from CSV files. Export data to CSV.
License: MIT License
Parse and retrieve data from CSV files. Export data to CSV.
License: MIT License
Hello php 7.49 trigger this errors
Deprecated: Array and string offset access syntax with curly braces is deprecated in ...\shuchkin\simplecsv\src\SimpleCSV.php on line 102
Deprecated: Array and string offset access syntax with curly braces is deprecated in ...\shuchkin\simplecsv\src\SimpleCSV.php on line 103
Can you please add download functionality in CSV as you created in XLSX gen?
I have tried to create CSV but for Spanish & Russian languages we are facing issues.
Actual Text : KESCH Számitástechnikai, Kereskedelmi és Szolgál- tató Felelősségü Társaság
After Export in CSV file : KESCH Sz?it?technikai, Kereskedelmi ? Szolg?- tat Felel?ss? T?sas?
My point is that I want to export excel file as text cells format or any other with empty cells.
Because if it's empty cells and I want to write a number in it, it will be like "123,698,789" but I need like "123698789"
so is there any way to export it.
Conditions under which the problem occurs:
;
delimiter.$delimiter
parameter is not specified when calling the parse()
or import()
methods (i.e., it remains 'auto'
).",
like this:"cell 1";"cell 2"
"cell 3";"cell ""4"", causing problem"
In these circumstances, the delimiter is auto-detected as ,
, although the actual delimiter is ;
. This leads to incorrect further CSV parsing, resulting in an array that looks like this:
array (
0 =>
array (
0 => 'cell 1;cell 2',
),
1 =>
array (
0 => 'cell 3;cell "4", causing problem',
),
)
array (
0 =>
array (
0 => 'cell 1',
1 => 'cell 2',
),
1 =>
array (
0 => 'cell 3',
1 => 'cell "4" NO problem',
),
)
As far as I understand, the problem is that the following 'if' condition doesn't cover the case where the file contains $this->_enclosure . ','
(i.e. ",
in this case) as an actual cell content (which is escaped as $this->_enclosure . $this->_enclosure . ','
("",
in this case)):
// detect delimiter
if ( strpos($this->_csv, $this->_enclosure . ',' ) !== false ) {
$this->_delimiter = ',';
} // else ...
So I made a quick fix with an additional check whether the previous character is NOT the same as _enclosure
:
// detect delimiter
// quick fix of wrong delimiter detection in some files with doublequotes (`"",` case)
$pos = strpos($this->_csv, $this->_enclosure . ',' );
$prev_char = substr($this->_csv, $pos - 1, 1);
if ( $pos !== false && $prev_char !== $this->_enclosure) {
$this->_delimiter = ',';
} // else ...
It works for me and solves this one particular case, but it doesn't cover other combinations of enclosures/delimiters inside cells, neither check for some edge cases like empty enclosed cells ("","cell 2"
). Please consider implementing the actual fix in your class.
The closing bracket of this array isn't the right kind:
$items = [ ['ISBN', 'title', 'author'], ['618260307','The Hobbit','J. R. R. Tolkien'] );
Latest php
SimpleCSV::export, strpos
Passing null to parameter #1 ($haystack) of type string is deprecated in SimpleCSV.php on line 162
if (is_null($v)) {continue;}
or something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.