Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Symbian mobile app - wrong charset - encoding
Forum Updated to NodeBB v4.3 + New Features

Symbian mobile app - wrong charset - encoding

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 5 Posters 5.8k Views 1 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.
  • T Offline
    T Offline
    tristenn
    wrote on last edited by
    #1

    Hello,
    !http://alergiaapp.madnes.eu/alergiaapp.jpg(app)!

    I developing mobile application in slovak language. I have everywere set encoding UTF-8. But slovak special characters are wrong on mobile. See the picture. Thanks for help.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kkrzewniak
      wrote on last edited by
      #2

      Have You tried playing with QTextCodec??

      QTextCodec::setCodecForCStrings() or void QTextCodec::setCodecForLocale ( QTextCodec * c )

      Me, Grimlock, not "nice dino". ME BASH BRAINS!

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

        No i dont. How / WHERE i can use this ? Thank you

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kkrzewniak
          wrote on last edited by
          #4

          @int main(int argc, char *argv[])
          {
          QApplication app(argc, argv);
          QTextCodec *codec = QTextCodec::codecForName("UTF-8");
          QTextCodec::setCodecForCStrings(codec);
          QTextCodec::setCodecForLocale(codec);
          ........
          return app.exec();
          }@

          Me, Grimlock, not "nice dino". ME BASH BRAINS!

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tristenn
            wrote on last edited by
            #5

            Thanks. Its ok in simulator but in mobile dont show some characters like žščľ... I have Sony Ericsson vivaz Symbian S60 5th edition

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mario
              wrote on last edited by
              #6

              Try changing encoding for the source files... "Tools->Options->Environment". Try changing "Default file encoding" to UTF-8 and see if it fixes the issue, it did for me for Swedish characters

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lukiluuk
                wrote on last edited by
                #7

                You can use the following code snippet for a specific string.

                @QTextCodec *codec = QTextCodec::codecForName("UTF-8");
                QString encodedString = codec->toUnicode(yourString);@

                The encodedString should then be in the correct encoding.

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

                  Actually the text encoding should match with the encoding used by the files that hold the text you want to read (e.g. your source files). If your editor stores the strings in non-utf8 and you instruct Qt to load the strings assuming it will be utf8 then this will not work correctly.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    lukiluuk
                    wrote on last edited by
                    #9

                    Hi
                    I had the same problem with german Umlaute. If reply is your QNetworkReply, it should work with the following code snippet.

                    @QTextCodec *codec = QTextCodec::codecForName("UTF-8");
                    QString encodedString = codec->toUnicode(reply->readAll());@

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

                      lukiluuk: If you know you are getting Utf8 then you can use QString::fromUtf8(). There is also some conversion routine for ASCII and Latin1 (both of which are straight forward to turn into unicode and thus do not need the full TextCodec treatment:-).

                      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