Vtiger 7 import special characters UTF8 doesn't work

1.1k views Asked by At

I just install Vtiger 7. I imported csv file of french leads. French language has speical characters éèû...

Of course, the import of these special characters didn't work. I get : Valérie instead of Valérie Félix instead of Félix

So I open my csv file with notepad, I check that special characters were correct, I save as UTF8 encoding.

I import again and get same issue.

I double check the TYPE of importation UTF8:

So I've been to the table vtiger_leaddetails and change type in utf8_general it didn't work. I tried with utf_unicode, it didn't work :-(

So if the csv file is UTF8, the fields of table are UTF8, if the TYPE of importation is UTF8, it means the Vtiger code is bugging somewhere?

So I searched on Google and here in the forum, and no answers to my issue.

Is there anyone who can help me with this issue?

Thanks

2

There are 2 answers

0
Jérémy On

Did you try tout select ISO-8859-1 in the Import window ?

0
Hamid On

You must convert MySQL database and tables character set and collation to UTF-8 before import.

Use the ALTER DATABASE and ALTER TABLE commands.

Use the following code to change collation

<?php
include_once 'includes/Loader.php';
include_once 'vtlib/Vtiger/Module.php';
include_once 'includes/runtime/EntryPoint.php';
$adb = PearDatabase::getInstance();
$sql = "ALTER DATABASE " . $dbconfig['db_name'] . " CHARACTER SET utf8 COLLATE utf8_general_ci;";
$result = $adb->query($sql);
$sql = "SHOW TABLES;";
$result = $adb->query($sql);
if ($adb->num_rows($result) > 0) {
    while ($row = $adb->fetch_array($result)) {
        $sql = "ALTER TABLE " . $row[0] . " CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
        $result = $adb->query($sql);
    }
}