-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove use of codecvt in PAL #44098
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @vitek-karas, @agocke |
There is only one usage of I think there are two approaches to solve this:
I tried #2, but it does not convert all characters on Linux; I think it relies on the locales installed on the build machine, unlike Therefore, while #1 might be riskier; as host might no longer be backwards compatible for some custom scenario which is using |
Since it is used just to convert between utf-8 and utf-16, we could possibly use the code we have in the coreclr PAL - the UnicodeToUTF8 and UTF8ToUnicode methods. |
However, it would not be nice to share as the code lives in different locations and it is heavily used by the coreclr PAL (via the MultiByteToWideChar and WideCharToMultiByte). |
I'm hesitant about #1 - it's changing the interface between runtime and hostpolicy. While we can make the change (the two components are shipped and versioned together), we typically try to avoid making breaking changes to the interface - just to be safe. I'm no expert on Linux so a "stupid" question: Linux doesn't have a UTF16->UTF8 conversion function available? If there's no better option #1 would work.. |
Hmm, I didn't know the UTF16 is a public contract. Too bad we didn't catch this when that was created, as UTF16 is kind of a Windowsism that we were trying to avoid on Unix (that's why the coreclr hosting APIs all use UTF-8). |
I was just trying to push back to make sure we don't make the interface change lightly. I do agree that it should have been UTF8 from the beginning (my bad as well). I think it should be OK to change the interface (as I said, those two components are shipped together and AFAIK there's no "extension" point - as in nobody implements its own hostpolicy, nor I've heard about anybody using the bundle probe when directly hosting coreclr.dll) |
codecvt was deprecated as of C++ 17, and likely should be removed for future compatibility.
In Windows, its included only in pal.windows.cpp, however it doesn't actually seem to be used anywhere.
In Unix, its included only in pal.linux.cpp, and is used to convert a utf8 string to utf16 string, which there for sure is another way to do this.
I noticed this, because this was added in April, and now causes the armel non tizen build to fail, as it does not have access to codecvt.
The text was updated successfully, but these errors were encountered: