Closed martincapello closed 3 years ago
Hi @martincapello 👋 it looks like there are some problems with gcc on Ubuntu with this (check the CI). I'm not sure but it looks like std::codecvt_utf8
was deprecated on C++17. I'm not sure about the availability or performance of the standard conversion vs the Win32 impl. I've found this too:
I saw this is failing for linux, and I think I can make it work, but I need to know first if we really want to merge this, otherwise it would be a waste of time.
From what I can see, it looks like codecvt_utf8 will be removed in the future:
But if you find other information we can see what to do.
Hi @martincapello 👋 it looks like there are some problems with gcc on Ubuntu with this (check the CI). I'm not sure but it looks like
std::codecvt_utf8
was deprecated on C++17. I'm not sure about the availability or performance of the standard conversion vs the Win32 impl. I've found this too:
Just saw that stackoverflow post a minute before your comment...so frustrating...will close this. Thanks.
Anyway it was a nice try to remove that Windows specific code, and I didn't know about codecvt, maybe in the future (I'm not sure if in C++23) there will be some standard Unicode conversion functions.
This PR replaces the use of
WideCharToMultiByte
andMultiByteToWideChar
to convert to and from utf8 strings by the use of the C++11 standard conversion functions.One thing to note is that the int parameter of
to_utf8
was removed, which breaks the compatibility with previous versions of the library. Not sure if we should keep it and adapt the function to work as before.WARNING: C++17 deprecates the codecvt header...so...maybe this PR doesn't worth it.