AStyle格式化中文乱码
-
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.
@Christian-Ehrlicher When using the clang-format beautification plugin for the downloaded LLVM 18.0.1 version, the problem is exactly the same.
-
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.
-
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.
@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。
-
@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。
@tomCJR said in AStyle格式化中文乱码:
please describe it in detail。
It's documented on the astyle website: https://astyle.sourceforge.net/astyle.html#_Usage
-
@tomCJR said in AStyle格式化中文乱码:
please describe it in detail。
It's documented on the astyle website: https://astyle.sourceforge.net/astyle.html#_Usage
@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.
-
So did you try it with astyle on the command line? Did it work there?
-
So did you try it with astyle on the command line? Did it work there?
@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
-
@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
@tomCJR said in AStyle格式化中文乱码:
but the garbled characters still exist
So, there IS a problem with Astyle.
-
@tomCJR said in AStyle格式化中文乱码:
but the garbled characters still exist
So, there IS a problem with Astyle.
@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
-
@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
@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?).
-
@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?).
@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.
-
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:
I think it works as expected. The text doesn't get distorted.