Do charset conversion once per line instead of on each field

This commit is contained in:
Nathan Gray 2011-12-05 15:49:56 +00:00
parent 1391b47ea6
commit f57b01dd42

View File

@ -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->fputcsv( $this->handle, $this->record, $this->csv_options['delimiter'], $this->csv_options['enclosure'] );
$this->num_of_records++; $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 // Not quite a recursive merge, since only one level
foreach($fields as $type => &$list) { foreach($fields as $type => &$list) {
if($c_fields[$type]) { if($c_fields[$type]) {
$list = array_merge($c_fields[$type], $list);; $list = array_merge($c_fields[$type], $list);
unset($c_fields[$type]); unset($c_fields[$type]);
} }
} }
@ -377,6 +374,9 @@ class importexport_export_csv implements importexport_iface_export_record
} }
$string .= "\n"; $string .= "\n";
// do charset translation
$string = $this->translation->convert( $string, $this->translation->charset(), $this->csv_charset );
fwrite($filePointer, $string); fwrite($filePointer, $string);
} }