Closed Morilli closed 1 year ago
This won't fix the issue as source of path is char const* which on windows by default is local code page. Correct way to fix this would be to either:
To set correct page encoding a manifest file can be provided to base library here: https://github.com/moonshadow565/ritobin/blob/master/ritobin_lib/CMakeLists.txt#L8
You can see example of how this is done in: https://github.com/LeagueToolkit/cslol-manager/blob/master/cslol-tools/CMakeLists.txt#L65
Okay I have no idea why but somehow just setting the codepage to utf8 in the manifest works...
Might as well pull in long path manifest?
The reason it works is because std::filesystem::path
on windows msvc stores paths internally as wchar_t (aka utf16).
It uses win32 api to convert from char to wchar_t which when set to utf8 codepage will naturally be encoded in utf8.
Might as well pull in long path manifest?
Can do that I guess.
It uses win32 api to convert from char to wchar_t which when set to utf8 codepage will naturally be encoded in utf8.
But that doesn't explain why that same mechanism produces garbage when the default codepage is not utf8 (shouldn't the commandline arg use the same codepage as the conversion function?).
But that doesn't explain why that same mechanism produces garbage when the default codepage is not utf8 (shouldn't the commandline arg use the same codepage as the conversion function?).
Can be for multiple reasons. If code page is mismatched between programs calling other programs it will lead into non-ascii characters converting to wrong characters when roundtriping thru wchar_t. If you are using msys built shell it could be likely that is trying to pass arguments as utf-8.
This was previously problematic on windows, where native paths are using utf-16 encoding, but file paths may be provided in a different encoding, like utf-8.