Closed Sallee1 closed 5 months ago
path::string() and path::u8string() implement exactly the same code, which I think is probably a mistake
I'm sorry, that it doesn't work the way you expected it to work.
It is documented in Differences in API in the README.md
though, and there is an additional "Important" paragraph in the platforms section of the same file that states this. Maybe it's not explicit enough, but the std::string interpretation is meant for both directions of the API, each std::string going in or out is UTF-8 and/or will be handled as such.
It is an explicit design choice following the "UTF-8 Everywhere" philosophy. I know this is not fitting everyone's needs, but was one way to limit the complexity for a single-developer project. There are currently no plans to change this implementation aspect of ghc::filesystem
.
PS: Sadly I don't have an easy temporary solution for this problem, as it seams the surrounding code is expecting more a more locale adapting solution. This library is only more or less a drop-in replacement if UTF-8 (or on Windows alternatively std::wstring) based Unicode is used.
Describe the bug
Specifically, when handling non-English paths,
std::filesystem::path::string()
correctly returns a string in the native encoding. In contrast,ghc::filesystem::path::string()
returns a UTF-8 string.To Reproduce
Expected behavior
ghc::filesystem::path::string()
should behave consistently withstd::filesystem::path::string()
and return a string in the native encoding.Additional context
Is this issue a bug or an intentional design choice?
As this library is used in business code, please provide a temporary solution to address this issue.