From f57b01dd4216b0be3fc76820bec6d016e739a370 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 5 Dec 2011 15:49:56 +0000 Subject: [PATCH] Do charset conversion once per line instead of on each field --- importexport/inc/class.importexport_export_csv.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/importexport/inc/class.importexport_export_csv.inc.php b/importexport/inc/class.importexport_export_csv.inc.php index a09160d94b..5555d0fa19 100644 --- a/importexport/inc/class.importexport_export_csv.inc.php +++ b/importexport/inc/class.importexport_export_csv.inc.php @@ -182,9 +182,6 @@ class importexport_export_csv implements importexport_iface_export_record } } - // do charset translation - $this->record = $this->translation->convert( $this->record, $this->translation->charset(), $this->csv_charset ); - $this->fputcsv( $this->handle, $this->record, $this->csv_options['delimiter'], $this->csv_options['enclosure'] ); $this->num_of_records++; } @@ -269,7 +266,7 @@ class importexport_export_csv implements importexport_iface_export_record // Not quite a recursive merge, since only one level foreach($fields as $type => &$list) { if($c_fields[$type]) { - $list = array_merge($c_fields[$type], $list);; + $list = array_merge($c_fields[$type], $list); unset($c_fields[$type]); } } @@ -377,6 +374,9 @@ class importexport_export_csv implements importexport_iface_export_record } $string .= "\n"; + // do charset translation + $string = $this->translation->convert( $string, $this->translation->charset(), $this->csv_charset ); + fwrite($filePointer, $string); }