Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QStrings (and other text) lose (ignore) embedded quote chars



  • Using QT4 development with VisualGDB. The single quote char (') is stripped from the text strings. For example:
    QString str = "That's strange" appears as "Thats strange"

    Single quotes are needed as I am using sql queries with SQLITE3.
    Also tried using the escape char ('):
    The following construct also fails:
    const char str = "That's strange" with the same results.


  • Qt Champions 2017

    welcome to the forum. This should not happen. I tried with Mac and gcc on linux. It was not filtered out. I agree with you that problem is happening. Is it happening with very simple sting you are trying ? I tried the following. It gave exact string. It worked as expected.

    @ QString str = "That's me";
    qDebug() << str;
    QLabel label(str);
    label.show();@

    Are you including this string some where else doing some manipulation ? Is it part of some bigger string ? May be in some specific case it is failing ?



  • No I am not, but I did find the problem. In VisualGDB when I do a quickwatch on the object (a string in this case), it does not show the single quotes, but if I check the length of the string, it does account for two single quotes. Rather strange...
    Thanks so much for the quick response.


Log in to reply