Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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
    David


  • Qt Champions 2019

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

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

Log in to reply