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

Problem in QtCreator with character "



  • in Qtcreator for windows, I entered QHostAddress("192.168.1.1"), it compiled without any problem, but in the QtCreator under Ubuntu Linux, I entered the same thing and got compiler error message: stray "\302..." in program. I copied the code from windows to linux, and found when viewed in the editor inside QtCreator, " is shown differently, " copied from windows is longer then " entered directly under Linux. I donot know what causes the difference? how to fix it? thanks a lot



  • In what is difference. And if your project is not to big, can you post it? Then we could give a real advice.



  • I mean double quote mark " " entered under linux causing codes cannot be compiled.



  • If it compiled correctly then you did not type:
    @
    QHostAddress(“192.168.1.1”)
    @

    with so-called 'smart' quotes ("U+201F, U+201D":http://en.wikipedia.org/wiki/List_of_Unicode_characters#General_Punctuation etc) or the like, you must have typed:
    @
    QHostAddress("192.168.1.1")
    @

    with "straight" quotes (U+0022) which is what your compiler is expecting.

    The stray "\302" is indicative of a byte with hex value C2, part of a UTF-8 encoding for a character in the range "U+0080 to U+00BF":http://en.wikipedia.org/wiki/C1_Controls_and_Latin-1_Supplement being interpreted a a simple C-string without regard for its encoding. Exactly where the data is coming from or being mangled we cannot see.


Log in to reply