Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. AStyle格式化中文乱码

AStyle格式化中文乱码

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
17 Posts 4 Posters 706 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.
  • C Christian Ehrlicher
    7 Apr 2025, 13:40

    Try astyle on the command line. I would guess your source code will get corrupted there too. Ask the astyle folks then as QtCreator only calls astyle on the soure file.

    T Offline
    T Offline
    tomCJR
    wrote on 7 Apr 2025, 13:59 last edited by
    #5

    @Christian-Ehrlicher When using the clang-format beautification plugin for the downloaded LLVM 18.0.1 version, the problem is exactly the same.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 7 Apr 2025, 14:11 last edited by
      #6

      Clang-format is also modifying the source file. Check on the command line. If you get the problem there too it's nothing QtCreator can do against.

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

      T 1 Reply Last reply 7 Apr 2025, 14:20
      0
      • C Christian Ehrlicher
        7 Apr 2025, 14:11

        Clang-format is also modifying the source file. Check on the command line. If you get the problem there too it's nothing QtCreator can do against.

        T Offline
        T Offline
        tomCJR
        wrote on 7 Apr 2025, 14:20 last edited by
        #7

        @Christian-Ehrlicher Then how to check whether there is a problem with AStyle or clang-format on the command line, please describe it in detail。

        C 1 Reply Last reply 7 Apr 2025, 15:14
        0
        • T tomCJR
          7 Apr 2025, 14:20

          @Christian-Ehrlicher Then how to check whether there is a problem with AStyle or clang-format on the command line, please describe it in detail。

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 7 Apr 2025, 15:14 last edited by
          #8

          @tomCJR said in AStyle格式化中文乱码:

          please describe it in detail。

          It's documented on the astyle website: https://astyle.sourceforge.net/astyle.html#_Usage

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

          T 1 Reply Last reply 8 Apr 2025, 01:48
          1
          • C Christian Ehrlicher
            7 Apr 2025, 15:14

            @tomCJR said in AStyle格式化中文乱码:

            please describe it in detail。

            It's documented on the astyle website: https://astyle.sourceforge.net/astyle.html#_Usage

            T Offline
            T Offline
            tomCJR
            wrote on 8 Apr 2025, 01:48 last edited by
            #9

            @Christian-Ehrlicher I have tried the method you mentioned, and I have used the default style, but it still doesn't work, I also downloaded the same qt version on other computers, the same operation, the same errors, the version installed on the old computer in early 24, I have forgotten the specific version, but there is no such problem, no garbled code. And it makes no difference that system information includes anything else, screening for problems by control variables one by one, and it feels like qt itself is a problem.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on 8 Apr 2025, 04:17 last edited by
              #10

              So did you try it with astyle on the command line? Did it work there?

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

              T 1 Reply Last reply 11 Apr 2025, 05:31
              0
              • C Christian Ehrlicher
                8 Apr 2025, 04:17

                So did you try it with astyle on the command line? Did it work there?

                T Offline
                T Offline
                tomCJR
                wrote on 11 Apr 2025, 05:31 last edited by
                #11

                @Christian-Ehrlicher said in AStyle格式化中文乱码:

                So did you try it with astyle on the command line? Did it work there?

                I have tried the command line and there is no problem, but the garbled characters still exist. After downloading other versions of Astyle on some platforms and the official website, the program can run normally, but the Chinese garbled characters still exist

                J 1 Reply Last reply 11 Apr 2025, 05:32
                0
                • T tomCJR
                  11 Apr 2025, 05:31

                  @Christian-Ehrlicher said in AStyle格式化中文乱码:

                  So did you try it with astyle on the command line? Did it work there?

                  I have tried the command line and there is no problem, but the garbled characters still exist. After downloading other versions of Astyle on some platforms and the official website, the program can run normally, but the Chinese garbled characters still exist

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 11 Apr 2025, 05:32 last edited by
                  #12

                  @tomCJR said in AStyle格式化中文乱码:

                  but the garbled characters still exist

                  So, there IS a problem with Astyle.

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

                  T 1 Reply Last reply 11 Apr 2025, 05:43
                  0
                  • J jsulm
                    11 Apr 2025, 05:32

                    @tomCJR said in AStyle格式化中文乱码:

                    but the garbled characters still exist

                    So, there IS a problem with Astyle.

                    T Offline
                    T Offline
                    tomCJR
                    wrote on 11 Apr 2025, 05:43 last edited by
                    #13

                    @jsulm said in AStyle格式化中文乱码:

                    @tomCJR said in AStyle格式化中文乱码:

                    but the garbled characters still exist

                    So, there IS a problem with Astyle.

                    Through my various attempts, I think that the high probability is the version of the qt tool, including the online platform download ah, he only listed the previous qt version (6.3 and 5 series), and no other old version information,But everyone else has no problem using Astyle the same version, the only difference is the version developed in qt, and mine is the latest version installed in March this year

                    J 1 Reply Last reply 11 Apr 2025, 06:09
                    0
                    • T tomCJR
                      11 Apr 2025, 05:43

                      @jsulm said in AStyle格式化中文乱码:

                      @tomCJR said in AStyle格式化中文乱码:

                      but the garbled characters still exist

                      So, there IS a problem with Astyle.

                      Through my various attempts, I think that the high probability is the version of the qt tool, including the online platform download ah, he only listed the previous qt version (6.3 and 5 series), and no other old version information,But everyone else has no problem using Astyle the same version, the only difference is the version developed in qt, and mine is the latest version installed in March this year

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 11 Apr 2025, 06:09 last edited by
                      #14

                      @tomCJR said in AStyle格式化中文乱码:

                      the version developed in qt

                      There is no Astyle version developed in Qt. QtCreator calls Astyle and if Astyle breaks something then this is not a QtCreator issue (you confirmed that you have same issue if you call Astyle directly, right?).

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

                      T 1 Reply Last reply 28 days ago
                      1
                      • J jsulm
                        11 Apr 2025, 06:09

                        @tomCJR said in AStyle格式化中文乱码:

                        the version developed in qt

                        There is no Astyle version developed in Qt. QtCreator calls Astyle and if Astyle breaks something then this is not a QtCreator issue (you confirmed that you have same issue if you call Astyle directly, right?).

                        T Offline
                        T Offline
                        tomCJR
                        wrote 28 days ago last edited by
                        #15

                        @jsulm said in AStyle格式化中文乱码:

                        @tomCJR said in AStyle格式化中文乱码:

                        the version developed in qt

                        There is no Astyle version developed in Qt. QtCreator calls Astyle and if Astyle breaks something then this is not a QtCreator issue (you confirmed that you have same issue if you call Astyle directly, right?).

                        I tried correctly and excluded the problems of astyle itself, and simply created a new text001.cpp file with obvious non-formatting features. After formatting this file through the command line tool, it was obviously formatted successfully after opening, and there was no garbled Chinese characters, so it proved that this was the related problem of qt for plug-ins.PixPin_2025-04-16_13-17-04.png

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          cristian-adam
                          wrote 28 days ago last edited by
                          #16

                          Just make sure that the tex codec for tools is set to UTF-8.

                          I tested on Windows a project:

                          • astyle
                          • clang-format as external tool (is shipped with Qt Creator)
                          • clang-format as part of the ClangFormat plugin

                          See the result below:
                          alt text

                          I think it works as expected. The text doesn't get distorted.

                          T 1 Reply Last reply 23 days ago
                          0
                          • C cristian-adam
                            28 days ago

                            Just make sure that the tex codec for tools is set to UTF-8.

                            I tested on Windows a project:

                            • astyle
                            • clang-format as external tool (is shipped with Qt Creator)
                            • clang-format as part of the ClangFormat plugin

                            See the result below:
                            alt text

                            I think it works as expected. The text doesn't get distorted.

                            T Offline
                            T Offline
                            tomCJR
                            wrote 23 days ago last edited by
                            #17

                            @cristian-adam said in AStyle格式化中文乱码:

                            Just make sure that the tex codec for tools is set to UTF-8.

                            I tested on Windows a project:

                            • astyle
                            • clang-format as external tool (is shipped with Qt Creator)
                            • clang-format as part of the ClangFormat plugin

                            See the result below:
                            alt text

                            I think it works as expected. The text doesn't get distorted.

                            I can't open the link you gave. Currently, I'm developing qt programs through Clion. Thank you

                            1 Reply Last reply
                            0

                            14/17

                            11 Apr 2025, 06:09

                            • Login

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