Important: Please read the Qt Code of Conduct -

mysql_real_query MySQL C API

  • Hi all,

    In my program I have this line:

    QString queryToExecute("SELECT 'Día'");
    mysql_real_query(dbConnection, queryToExecute.toUtf8().data(), queryToExecute.toUtf8().length());

    And it works just fine on Linux and Linux, but in Windows the í char is no sent the correct way, I mean, the Database Server does not receive and í.

    I have tried the QTextCodec class but it does not work.

    ¿Any other idea?

    Best regards

  • Lifetime Qt Champion

    This is due to your locale on windows is something != utf-8

    auto queryToExecute(QString::fromUtf8(u"SELECT 'Día'"));

Log in to reply