Visual Studio 2019 and 2022 Resource Editor is able to correctly read and display .rc file in UTF-8 encoding if .rc file is saved without UTF-8 BOM.
The main requirements for it, .rc file must contain valid #pragma code_page
.
Example:
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(65001)
But if you did some changes in textual resource and saves result back to .rc file, it will be corrupted:
- all
#pragma code_page(65001)
will be replaced by your default ANSI code page (e.g.#pragma code_page(1252)
) - all non ANSI symbol will be replaced by
?
.
Is there some way how to work with UTF-8 c++ resource in Visual Studio 2019\2022 Resource Editor without this bug.
P.S.:
- I don't use Unicode (UTF-16 LE) encoding due to problems in git with it.
- Using UTF-8 without BOM is single way how to compile UTF-8 .rc file in Visual Studio, see link.
Microsoft knows about this bug and they decided not to fix it:
See https://developercommunity.visualstudio.com/t/visualstudio-v1590-resource-editor-using-utf-8-bom/384705