Author: cedric@yterium.com
Date: Fri Jul 7 11:57:59 2006
New Revision: 3837
Log:
importer le charset lors de l'import csv
Modified:
_plugins_/_contenu_editorial_/CSVImport/inc/csvimport.php
Modified: _plugins_/_contenu_editorial_/CSVImport/inc/csvimport.php
--- _plugins_/_contenu_editorial_/CSVImport/inc/csvimport.php (original)
+++ _plugins_/_contenu_editorial_/CSVImport/inc/csvimport.php Fri Jul 7 11:57:59 2006
@@ -184,14 +184,22 @@
* @param int $len Line length to be passed to fgetcsv
* @return array or false on failure to retrieve any rows.
*/
+
+function csvimport_importcharset($texte){
+ return importer_charset($texte, 'iso-8859-1');
+}
+
function csvimport_importcsv($file, $head = false, $delim = ",", $enclos = '"', $len = 1000) {
+ include_spip('inc/charset');
$return = false;
$handle = fopen($file, "r");
if ($handle){
if ($head) {
$header = fgetcsv($handle, $len, $delim);
+ $header = array_map('csvimport_importcharset',$header);
}
while (($data = fgetcsv($handle, $len, $delim)) !== FALSE) {
+ $data = array_map('csvimport_importcharset',$data);
if ($head AND isset($header)) {
foreach ($header as $key=>$heading) {
$row[$heading]=(isset($data[$key])) ? $data[$key] : '';