Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt/QML Mangling Text String
Qt 6.11 is out! See what's new in the release blog

Qt/QML Mangling Text String

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
10 Posts 5 Posters 1.5k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    While_e
    wrote on last edited by
    #1

    I'm attempting to display some static text with something like the following pseudo code:

    Import QtQuick 2.5
    Import QtQuick.Window 2.1
    
    Window{
      Text{
        text: "Something Is Not Connected"
      }
    }
    

    It is taking the "No" and converting it to the numero symbol "№", so it reads "Something Is №t Connected". It seems to be a combination of the font being used (Nimbus Sans L) and the Qt version (5.14). If I change either of these the issue goes away.

    Is there something I'm missing, or some way I can explicitly instruct Qt/QML not to mangle the string like this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Could it be that the o is a similar char but with a different utf8 number ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        While_e
        wrote on last edited by
        #3

        This was kind of where my head was at, but I'm not sure how to prove this, or work around it. Also seems very odd the exact same code works on any other Font or version of Qt.

        1 Reply Last reply
        0
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          If there is no work around maybe you can use this:
          https://www.fileformat.info/info/unicode/char/200b/index.htm

          C++ is a perfectly valid school of magic.

          1 Reply Last reply
          0
          • MarkkyboyM Offline
            MarkkyboyM Offline
            Markkyboy
            wrote on last edited by
            #5

            I'm also using Qt 5.14 and purposely installed the nimbus font to my OS (windows 7) but am unable to reproduce your problem.

            Out of curiosity, if you write your text as all lowercase, does the problem persist?

            Don't just sit there standing around, pick up a shovel and sweep up!

            I live by the sea, not in it.

            1 Reply Last reply
            0
            • W Offline
              W Offline
              While_e
              wrote on last edited by
              #6

              No, it only happens when I use a combination of "No" ... like "Not" .."Nothing".. etc. Curious why it doesn't happen for you. Are you running on Windows 10?

              MarkkyboyM 1 Reply Last reply
              0
              • W While_e

                No, it only happens when I use a combination of "No" ... like "Not" .."Nothing".. etc. Curious why it doesn't happen for you. Are you running on Windows 10?

                MarkkyboyM Offline
                MarkkyboyM Offline
                Markkyboy
                wrote on last edited by
                #7

                @While_e said in Qt/QML Mangling Text String:

                No, it only happens when I use a combination of "No" ... like "Not" .."Nothing".. etc. Curious why it doesn't happen for you. Are you running on Windows 10?

                No, as stated previously, I'm using Windows 7

                Don't just sit there standing around, pick up a shovel and sweep up!

                I live by the sea, not in it.

                1 Reply Last reply
                0
                • W Offline
                  W Offline
                  While_e
                  wrote on last edited by
                  #8

                  Apologies, read that too quickly.

                  J.HilkJ 1 Reply Last reply
                  0
                  • W While_e

                    Apologies, read that too quickly.

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    @While_e ok 2 things you can try as well,

                    first wrap the text in a translation unit:

                    Window{
                      Text{
                        text: qsTr("Something Is Not Connected")
                      }
                    }
                    

                    2nd: Combine your o explicitly

                    Window{
                      Text{
                        text: "Something Is N"+ "\u006F" + "t Connected"
                      }
                    }
                    

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    1 Reply Last reply
                    0
                    • W Offline
                      W Offline
                      While_e
                      wrote on last edited by
                      #10

                      I've tried both of these any they still fail. The only things that work are either insert a "Zero Width Space" between them, or the cleaner solution.. just remove the numero glyph from the font altogether.

                      I was hoping this would be a known issue in some way, but these options will work for now. If I have more time I'll try to either investigate, or get enough info to open a bug report.

                      Thank you for all the input.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved