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. Accents in Qml
QtWS25 Last Chance

Accents in Qml

Scheduled Pinned Locked Moved QML and Qt Quick
15 Posts 10 Posters 13.4k Views
  • 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.
  • P Offline
    P Offline
    puelocesar
    wrote on last edited by
    #1

    Hi, I'm having problems with international accents on Qt Quick. Here is an example:

    !http://img259.imageshack.us/img259/9013/tela.png(problem)!

    And here is my code:

    @Text {
    id: corpo_texto
    width: 152
    height: 65

        text: "O mundo precisa se unir pra manter o #Wikileaks ativo e funcionando. Faz tempo que eu não vejo um grupo e uma iniciativa tão corajosos."
        wrapMode: "WordWrap"
    

    }@

    How to solve this? Sorry if it's a basic question, but I found it anywere how to solve this on Qml.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Which encoding is your source file in? I think Qt Quick expects its strings in utf-8 encoding.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        thatbloke
        wrote on last edited by
        #3

        Hi, I had a similar problem recently when trying to use Unicode characters. For me, the problem was that the QML file itself was not in UTF-8 format. Ensure it is in UTF-8 format and then try re-running the app.

        It does raise the issue of a possible bug, though - even if the file is not in UTF-8 format you can still type in non-ascii characters and see them perfectly fine in the creator, even after saving the file, giving the impression that the text has been saved correctly, when in fact it hasn't been.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          puelocesar
          wrote on last edited by
          #4

          Yes, that's it. Thanks for the help folks!

          The problem is that Qt Creator is creating the files using the system's default, which is ISO on Windows. I had to close it on Qt Creator and convert the file in Notepad++, and set Qt Creator to always use UTF8. Now it's everything fine.

          By the way, shoudn't Qt Creator be set to UTF8 by default then?

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tobias.hunger
            wrote on last edited by
            #5

            puelocesar: This is mostly a windows issue as all other OSes default to UTF-8 anyway. If we would use UTF-8 in creator by default then you would get the garbage you saw in your QML application in creator... so that is not really an option:-/

            I wish windows would finally give up on the code pages and switch to unicode by default... they do support unicode ever since Win 95 times IIRC.

            1 Reply Last reply
            0
            • P Offline
              P Offline
              parancibia
              wrote on last edited by
              #6

              puelocesar: you don't need Notepad++ only select the Select Encoding option located in the Edit Menu of Qt Creator.

              !http://realnorth.net/share/TextEncoding.png(Select Encoding)!

              1 Reply Last reply
              0
              • P Offline
                P Offline
                puelocesar
                wrote on last edited by
                #7

                Cool! I didn't found that! Thanks for the tip

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  syrianzoro
                  wrote on last edited by
                  #8

                  If you use MsWindows

                  CMD>lupdate YourText.qml -ts YourText.ts

                  1 - open YourText.ts in Linguist(C:\Qt\4.7.0\bin\linguist.exe)
                  2- provide a translation
                  3- create the release file YourText.qm.

                  CMD> qmlviewer -translation YourText.qm YourText.qml

                  Qt is the future

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbrasser
                    wrote on last edited by
                    #9

                    Tobias: Are QML files generated by creator on Windows UTF-8 by default? If not, can they be?

                    1 Reply Last reply
                    0
                    • kkoehneK Offline
                      kkoehneK Offline
                      kkoehne
                      Moderators
                      wrote on last edited by
                      #10

                      I opened a bug for qtcreator that this should be fixed in 2.2: http://bugreports.qt.nokia.com/browse/QTCREATORBUG-3424

                      Director R&D, The Qt Company

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        changsheng230
                        wrote on last edited by
                        #11

                        Will keep track of it. Nice discussion.

                        Chang Sheng
                        常升

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DenisKormalev
                          wrote on last edited by
                          #12

                          changsheng230, what do you mean? discussion was ended half a year ago, bug is already closed. Please, don't necropost.

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            changsheng230
                            wrote on last edited by
                            #13

                            This might not be a suitable action, sorry for that. However, I comment it for the sake of archving my "favorite" discussion so that I was able to find it in a faster way. Moreover, I will update my creator to 2.2.0 to have a try whehter it is OK.
                            [quote author="Denis Kormalev" date="1310274100"]changsheng230, what do you mean? discussion was ended half a year ago, bug is already closed. Please, don't necropost.[/quote]

                            Chang Sheng
                            常升

                            1 Reply Last reply
                            0
                            • EddyE Offline
                              EddyE Offline
                              Eddy
                              wrote on last edited by
                              #14

                              Hi Changsheng,

                              What you can do to find the articles back you like is using the rate up button. In the future there will be a way to filter those you have rated up.

                              At this moment you could add the page to your bookmarks in your favorite web browser.

                              Qt Certified Specialist
                              www.edalsolutions.be

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                changsheng230
                                wrote on last edited by
                                #15

                                Thank a lot for your comments
                                [quote author="Eddy" date="1310279256"]Hi Changsheng, What you can do to find the articles back you like is using the rate up button. In the future there will be a way to filter those you have rated up. At this moment you could add the page to your bookmarks in your favorite web browser.[/quote]

                                Chang Sheng
                                常升

                                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