Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b4d1c5c
)
csv download: use comma, not tab as separator
author
Jason Woofenden
<jason@jasonwoof.com>
Tue, 28 Aug 2012 05:59:38 +0000
(
01:59
-0400)
committer
Jason Woofenden
<jason@jasonwoof.com>
Tue, 28 Aug 2012 05:59:38 +0000
(
01:59
-0400)
csv.php
patch
|
blob
|
history
diff --git
a/csv.php
b/csv.php
index
fd67a43
..
9f2a0f2
100644
(file)
--- a/
csv.php
+++ b/
csv.php
@@
-1,7
+1,7
@@
<?php
<?php
-# This file generates what Excell refers to as "CSV" files. This format makes
-# little sense, and does not actually have anything to do with commas.
+# These functions redutrn a csv download which is hopefully easy to import into
+# Excell and LibreOffice Calc
# pass in a 2d array (array of rows) and it'll send it to the browser
# I can't figure out how to get multi-line fields to work, so this replaces newlines with 4 spaces.
# pass in a 2d array (array of rows) and it'll send it to the browser
# I can't figure out how to get multi-line fields to work, so this replaces newlines with 4 spaces.
@@
-14,7
+14,7
@@
function array2d_to_csv_download($data, $filename) {
if($first) {
$first = false;
} else {
if($first) {
$first = false;
} else {
- echo "\t";
+ echo ",";
}
echo '"' . str_replace("\n", " ", str_replace('"', '""', $el)) . '"';
}
}
echo '"' . str_replace("\n", " ", str_replace('"', '""', $el)) . '"';
}