PDA

View Full Version : Problem migrate frensh characters from Interbase to Mysql



mourad
4th February 2009, 07:50
Hello everybody, I've written a Qt program which migrate data from an Interbase database to a MySQL database.
It works fine but I've a problem with frensh characters like (é, è, à , etc).
Those charcaters are fine in the interbase database, but after executing the select request to have data and I display the data I've selected those characters are displayed as " ? ".
This my connection function
QSqlDatabase db = QSqlDatabase::addDatabase(driver, name);
db.setHostName(host);
db.setDatabaseName(path);
db.setUserName(user);
db.setPassword(pwd);
if(driver == "IBASE")
db.setConnectOptions("ISC_DPB_LC_CTYPE = LATIN1");

if(!db.open())
{
qCritical() << "Erreur Ouverture base de données : " << db.lastError().text();
return false;
}
return true;.
Can anyone tel me where I'm wrong and how to do resolve this problem.
Knowing that I've tried to user QTextCodec like
QTextCodec *codec = QTextCodec::codecForName("LATIN1");
qDebug() << codec->toUnicode(q1.value(1).toByteArray()); but I've always the same result " ? ".
Many thanks in advance.
Best Regurads.

jacek
5th February 2009, 23:50
It should work out of the box. Just throw away line #7.