Do charset conversion once per line instead of on each field

This commit is contained in:
Nathan Gray 2011-11-25 23:12:08 +00:00
parent 5d77dbfdc9
commit 288d40065a

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->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);
}