瀏覽代碼

Prepare charset

Laurent Destailleur 2 年之前
父節點
當前提交
2742da2379

+ 2 - 0
htdocs/core/modules/import/import_csv.modules.php

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

+ 3 - 0
htdocs/core/modules/import/modules_import.php

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

+ 2 - 0
htdocs/imports/import.php

@@ -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)) {