Prepare charset

This commit is contained in:
Laurent Destailleur 2023-04-18 16:56:17 +02:00
parent 224c7b1847
commit 2742da2379
3 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,8 @@ class ImportCsv extends ModeleImports
public $nbupdate = 0; // # of update done during the import
public $charset = '';
/**
* Constructor

View File

@ -75,6 +75,9 @@ class ModeleImports
public $libversion = array();
public $charset;
/**
* @var array Element mapping from table name
*/

View File

@ -142,6 +142,7 @@ $endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator', 'alphanohtml') ? GETPOST('separator', 'alphanohtml', 3) : '');
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"'); // We must use 'nohtml' and not 'alphanohtml' because we must accept "
$charset = GETPOST('charset', 'aZ09');
$separator_used = str_replace('\t', "\t", $separator);
$objimport = new Import($db);
@ -802,6 +803,7 @@ if ($step == 4 && $datatoimport) {
if ($model == 'csv') {
$obj->separator = $separator_used;
$obj->enclosure = $enclosure;
$obj->charset = '';
}
if ($model == 'xlsx') {
if (!preg_match('/\.xlsx$/i', $filetoimport)) {