Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
钱宇 committed Sep 11, 2024
1 parent 2853fcb commit ce319ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/GoodCodecCSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ public static function csv_encode_row($row, $out_charset = "UTF-8", $in_charset
$enclosure = isset($enclosure) ? $enclosure : "\"";
$force_quote = isset($force_quote) ? $force_quote : 0;
$s = "";
foreach ($row as $idx => $str) {
if ($idx !== 0) {
$idx = -1;
foreach ($row as $str) {
if (++$idx !== 0) {
$s .= $delimiter;
}
$s .= self::csv_encode_str($str, "UTF-8", $in_charset, 0, $null, $delimiter, $enclosure, $force_quote);
Expand Down
10 changes: 6 additions & 4 deletions src/GoodCodecTSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public static function tsv_encode_row($row, $out_charset = "UTF-8", $in_charset
}
$need_iconv = $in_charset !== "UTF-8";
$s = "";
foreach ($row as $k => $str) {
if ($k != 0) {
$idx = -1;
foreach ($row as $str) {
if (++$idx !== 0) {
$s .= "\t";
}
if ($str === NULL) {
Expand Down Expand Up @@ -75,8 +76,9 @@ public static function tsv_encode_table($data, $out_charset = "UTF-8", $in_chars
$need_iconv = $in_charset !== "UTF-8";
$s = "";
foreach ($data as $row) {
foreach ($row as $k => $str) {
if ($k != 0) {
$idx = -1;
foreach ($row as $str) {
if (++$idx !== 0) {
$s .= "\t";
}
if ($str === NULL) {
Expand Down

0 comments on commit ce319ac

Please sign in to comment.