fix: fix utf-8 output error.

- I figure out how UTF-8 output bug happend, but I don't have any clues proving why this happend.
	- it seems that we can simply remove utf8 string literal heading to solve this issue (u8"" -> "")
	- the compiled string char array in executable application already is wrong.
	- compiler generated string bytes is `'original string'.encode('utf-8').decode(your pc encoding).encode('utf-8')`.
	- idk why, as the compromise, I remove all utf8 string literal heading to solve this issue.
	- I highly think this is a bug of MSVC. because everything is okey if I use MSVC native project file to build.
	- I have compared the build flags between native project and cmake generated project but I can't find any difference.
- add full testbench code for ParserHelper.
This commit is contained in:
2024-05-30 14:53:46 +08:00
parent 5726c81fdb
commit e1e8a33c50
3 changed files with 53 additions and 13 deletions

View File

@ -77,7 +77,7 @@ namespace YYCC::DialogHelper {
return false;
// convert pattern and join them
std::string joined_modes(YYCC::StringHelper::Join(it.second, u8";"));
std::string joined_modes(YYCC::StringHelper::Join(it.second, ";"));
WinFileFilters::WinFilterModes modes;
if (!YYCC::EncodingHelper::UTF8ToWchar(joined_modes.c_str(), modes))
return false;