Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QString encoding problem
Qt 6.11 is out! See what's new in the release blog

QString encoding problem

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 395 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.
  • L Offline
    L Offline
    LISP
    wrote on last edited by
    #1

    I write code on windows and run it on raspberry pi.

    1. QString("character");
    2. QString::fromLocal8Bit("character");
    3. QString::fromUtf8("character");

    When outputting to the screen in 3 ways in Windows, only 2 succeeds, and characters 1 and 3 are broken. However, all characters are broken when running on Raspberry Pi.

    Are there any other encoding methods?

    What should I look for to solve the problem?

    thank you for reading my poor english

    jsulmJ 1 Reply Last reply
    0
    • L LISP

      @jsulm Characters are displayed as squares or unknown characters.
      ex) apple -> □ψㆋㄻ∇

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @LISP said in QString encoding problem:

      Characters are displayed as squares or unknown characters.

      Which ones? And where (on the console, in your gui?) Non-ascii ones? If so make sure your source code is utf-8 and your compiler treats it as utf-8. Also please provide some code so we can see what you're doing. What Qt version do you use?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • L LISP

        I write code on windows and run it on raspberry pi.

        1. QString("character");
        2. QString::fromLocal8Bit("character");
        3. QString::fromUtf8("character");

        When outputting to the screen in 3 ways in Windows, only 2 succeeds, and characters 1 and 3 are broken. However, all characters are broken when running on Raspberry Pi.

        Are there any other encoding methods?

        What should I look for to solve the problem?

        thank you for reading my poor english

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @LISP In what way is it "broken"?
        What exactly do you want to achieve?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • L Offline
          L Offline
          LISP
          wrote on last edited by LISP
          #3

          @jsulm Characters are displayed as squares or unknown characters.
          ex) apple -> □ψㆋㄻ∇

          Christian EhrlicherC 1 Reply Last reply
          0
          • L LISP

            @jsulm Characters are displayed as squares or unknown characters.
            ex) apple -> □ψㆋㄻ∇

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @LISP said in QString encoding problem:

            Characters are displayed as squares or unknown characters.

            Which ones? And where (on the console, in your gui?) Non-ascii ones? If so make sure your source code is utf-8 and your compiler treats it as utf-8. Also please provide some code so we can see what you're doing. What Qt version do you use?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            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