Hello,

i have reported last year on the tracker a strange behaviour with this 
function : https://bugreports.qt-project.org/browse/QTBUG-23139.

in fact a string empty is also null.

For exemple :

#include <QCoreApplication>
#include <QTextCodec>
#include <QDebug>
int main(int argc, char *argv[])
{
     QCoreApplication a(argc, argv);
     QTextCodec *_code = 
QTextCodec::codecForName(QString(QLatin1String("Windows-1252")).toLocal8Bit());
     QString _t = _code->toUnicode("");
     qWarning() << "codec toUnicode" << _t.isEmpty() << _t.isNull();
     // return true  and true; bad
     _t = QString::fromUtf8("");
     qWarning() << "fromUtf8" << _t.isEmpty() << _t.isNull();
     // return true and false; good


     return a.exec();
}

it causes problems with database driver because when a QString is empty 
the driver database can put null into the database.

as i say in the bug tracker the problem seems to be in qsimplecodec.cpp 
in the function convertToUnicode.

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to