Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any option can change output encoding to UTF8 in DEBUG CONSOLE panel? #4136

Open
Xsakura1314 opened this issue Oct 22, 2024 · 5 comments
Open
Labels
more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@Xsakura1314
Copy link

Brief Issue Summary

I want to try debugging and printing some Chinese characters, but the output in the Debug Console panel is incorrect. My file encoding is utf8, system encoding is gbk. I would like to know if there is a CMake Tools or VSCode configuration option can change Debug Console panel to utf8 encoding.

int main(int argc, char *argv[]) {
  qDebug() << "你好1";
  fmt::println("你好2");
  std::cout << "你好3" << std::endl;
  return 0;
}

Image

I have already added the following statements in my CMakeLists.txt,

if (MSVC)
	add_compile_options("/utf-8")
endif()

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

Enviroment

System: Windows 11(x64 23H2 GBK encoding)

Softeware:

  • VSCode v1.94.2
  • Cmake v3.30.1
  • CMake Tools v1.19.52

Compiler : MSVC2019

@Amy-Li03
Copy link
Collaborator

Hi @Xsakura1314 , thanks for reporting issue here! And could you please set following option to check whether your issue was resolved?
"cmake.outputLogEncoding": "utf8"

@Amy-Li03 Amy-Li03 added more info needed More info is needed from the community for us to properly triage and investigate. and removed triage labels Oct 23, 2024
@Xsakura1314
Copy link
Author

@Amy-Li03
Thank you for your response. I have tried your method, and restarted VSCode, but it still does not work properly.
Do I need to provide more information?

Image

@Amy-Li03
Copy link
Collaborator

@Xsakura1314 thank you for your reply!
It seems that your issue is dup with this one: #3632, it is a bug, and our development team will investigate it later.
Please confirm if this is same as yours.

@Xsakura1314
Copy link
Author

Xsakura1314 commented Oct 25, 2024

I find a not elegant way to solve the problem, which is change my system encoding to Unicode UTF-8.

Thus I guess the VSCode DEBUG CONSOLE panel is still using GBK encoding instead of UTF-8 encoding when debug via CMake Tools, even though I tried to set it to UTF-8 in the CMakeLists.txt file. In fact , they are not related.

I can't find an option to change the DEBUG CONSOLE panel encoding in VSCode.

May need an option to change it.

Image
Image

@Amy-Li03
Copy link
Collaborator

Amy-Li03 commented Oct 28, 2024

Thanks for sharing solution at here!
We have linked this issue with #3632 , after that is fixed, please verify this one.
Thanks for help us build a better Visual Studio Code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More info is needed from the community for us to properly triage and investigate.
Projects
Status: Blocked
Development

No branches or pull requests

2 participants