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

Symbols in QMAKE_TARGET_COPYRIGHT?



  • Has anyone tried adding the copyright symbol to the QMAKE_TARGET_COPYRIGHT .pro value?
    On Windows, it only half works. You get the symbol but it's always preceded by a capital A with a little circle over it.
    Same thing happens if you try to use the registered trademark symbol in QMAKE_TARGET_PRODUCT.
    It all looks fine in Qt Creator so I don't know if it's a Windows bug or if it happens during the build.



  • @RogueWarrior said:

    Has anyone tried adding the copyright symbol to the QMAKE_TARGET_COPYRIGHT .pro value?

    At a quick glance, it would appear not (github search).

    However, it sounds like character encoding / misinterpretation issue.

    I'm guessing:

    • you've pasted the UTF-8 encoding for "COPYRIGHT SIGN" into your *.pro file
    • that character, in UTF-8, is the bytes 0xC2 and 0xA9
    • you're using a latin or ASCII charset in your *.rc file's StringFileInfo block(s)
    • those bytes in Latin-1 are "Capital A circumflex" (Â) and "Copyright sign" (©)

    You could either:

    • encode your *.pro file in ASCII (not sure what encoding(s) qmake officially supports for *.pro files, eg QTBUG-27896?); or
    • change your *.rc file's StringFileInfo block to use UTF-8 (unfortunately, I doubt this will work - MS appears to only support "Unicode", which is usually MS-speak for 16-bit chars); or
    • use some char-escape sequence in the *.pro file (does qmake support things like "\xA9"?)

    I can see why everyone else seems to have settled for "(c)".

    Cheers.



  • Just looking at the qmake source, the default RC file that qmake generates specified the Unicode charset (though the code doesn't actually guarantee that it's writing UCS-2 - it depends on the configured Windows locale).

    Are you using a default-generated RC file, or have you hand-written your own RC file? ie does your *.pro file specify either RC_FILE or RES_FILE?



  • @Paul-Colby I just used the .pro file. Haven't tried messing with the .rc file yet.



  • After a little more reading, its seems that your supposed to use the (magic?) "\251" sequence for the copyright symbol in Windows resource files. I see no official reference documentation for why that is, and no doubt it pre-dates Microsoft's Unicode support, but it is used in various Microsoft examples, such as https://msdn.microsoft.com/en-us/library/cc194812.aspx

    Note, using a platform-specific value like this would usually bother me, but QMAKE_TARGET_COPYRIGHT is a Windows only variable anyway, so it shouldn't be a problem? (if it did bother you, you could hand-bake your own *.rc file)

    Finally, here's some examples from Github of *.pro files using \251 - https://github.com/search?utf8=✓&q=QMAKE_TARGET_COPYRIGHT+AND+\251&type=Code&ref=searchresults but it essentially boils down to something like:

    QMAKE_TARGET_COPYRIGHT = "\\251 2016 All my code belongs to me"
    

    Cheers.



  • Awesome! That works great. FYI, \256 is the magic incantation for the registered trademark symbol.


Log in to reply