I am chinese and always use imgui.When I updated Visual Studio to the latest version this morning, the code reported errors.
ImGui::Text(u8"颜色(Color)");
This code works fine before Visual Studio version 16.2.0,But it doesn't works after I updated it this morning.
The wrong:
Including Chinese: error C2664: “void ImGui::Text(const char *,...)”: 无法将参数 1 从“const char8_t [7]”转换为“const char *”
English:void ImGui::Text(const char *,...)”: Cannot convert parameter 1 from "const char8_t [7]" to "const char *"
Maybe code error related to imgui
In addition, my project compiles normally when I delete "u8". However, after deleting "u8", Chinese cannot be displayed normally
Hi, not sure exactly why that is happening but I just tried using the latest ImGui version and also VS 16.2 and I can build that code
ImGui::Text(u8"颜色(Color)");
If I remove the u8 like you said I can still build but I get a build warning.

The Chinese characters aren't showing but that's probably the font I have not supporting it, but I get no build errors.

I don't think this is ImGui related, did VS updated recently or something? Maybe related to the Character Set (unicode, multi-byte, etc) you choose for the build? A sure way to be sure would be to rollback ImGui to the last version you were sure it worked and try that code again, if it works now we know, if it still doesn't work it's something else. Sorry I can't help more without more info.
Hi, not sure exactly why that is happening but I just tried using the latest ImGui version and also VS 16.2 and I can build that code
ImGui::Text(u8"颜色(Color)");If I remove the u8 like you said I can still build but I get a build warning.
The Chinese characters aren't showing but that's probably the font I have not supporting it, but I get no build errors.
I don't think this is ImGui related, did VS updated recently or something? Maybe related to the Character Set (unicode, multi-byte, etc) you choose for the build? A sure way to be sure would be to rollback ImGui to the last version you were sure it worked and try that code again, if it works now we know, if it still doesn't work it's something else. Sorry I can't help more without more info.
Hello,I've changed the C++ language standard.When I change std:c++latest to std:c++17, the project compiles properly.But does compiling like this have any bad effects?
Hello,I've changed the C++ language standard.When I change std:c++latest to std:c++17, the project compiles properly.But does compiling like this have any bad effects?
"std:c++ latest" is using a preview version of what will be c++ 20 (working draft), which is not fully compatible yet with most compilers. c++17 is the latest c++ revision that majority of compilers should be compatible now, so you should be fine.

Hello,I've changed the C++ language standard.When I change std:c++latest to std:c++17, the project compiles properly.But does compiling like this have any bad effects?
"std:c++ latest" is using a preview version of what will be c++ 20 (working draft), which is not fully compatible yet with most compilers. c++17 is the latest c++ revision that majority of compilers should be compatible now, so you should be fine.
Thank you for your kind help.Another warm-hearted friend offered me a piece of advice.
Add /Zc:char8_t- option to compiler command line.
But I don't know where it compiler command line in the project property in Chinese.I tried to ask this question in Chinese programming BBS,but they don't seem to know.If convenient, can you mark its location in the project properties and take a screenshot?Millions of thanks!

I think this is what you are looking for "Treat Wchar_t As Built in Type"
It's not ImGui related . char8_t is a distinct type introduced by C++20 (but ImGui depends on lower C++ standard) , it's not equivalent to char . https://stackoverflow.com/questions/56833000/c20-with-u8-char8-t-and-stdstring
I think using UTF-8 as the default charset of the project would be more portable than u8 string literal. You can add an UTF-8 BOM to your source file (Or add an option /utf-8 in the command line) to let Microsoft C++ compiler know it's UTF-8 encoding . https://devblogs.microsoft.com/cppblog/new-options-for-managing-character-sets-in-the-microsoft-cc-compiler/ And it is compatible with other C++ compilers.
This is not an issue with ImGui probably.
Maybe close this once verified?
Closing as answered, thanks @djdeath @cloudwu !
Most helpful comment
It's not ImGui related .
char8_tis a distinct type introduced by C++20 (but ImGui depends on lower C++ standard) , it's not equivalent tochar. https://stackoverflow.com/questions/56833000/c20-with-u8-char8-t-and-stdstringI think using UTF-8 as the default charset of the project would be more portable than u8 string literal. You can add an UTF-8 BOM to your source file (Or add an option
/utf-8in the command line) to let Microsoft C++ compiler know it's UTF-8 encoding . https://devblogs.microsoft.com/cppblog/new-options-for-managing-character-sets-in-the-microsoft-cc-compiler/ And it is compatible with other C++ compilers.