RFR: 8195129: System.load() fails to load from unicode paths [v3]
Naoto Sato
naoto at openjdk.java.net
Thu Jun 3 17:51:40 UTC 2021
On Thu, 3 Jun 2021 06:55:26 GMT, Maxim Kartashev <github.com+28651297+mkartashev at openjdk.org> wrote:
>> src/hotspot/os/windows/os_windows.cpp line 1491:
>>
>>> 1489: static errno_t convert_UTF8_to_UTF16(char const* utf8_str, LPWSTR* utf16_str) {
>>> 1490: return convert_to_UTF16(utf8_str, CP_UTF8, utf16_str);
>>> 1491: }
>>
>> IIUC, `utf8_str` is the "modified" UTF-8 string in JNI. Using it as the standard UTF-8 (I believe Windows' encoding `CP_UTF8` is the one) may end up in incorrect conversions in some corner cases, e.g., for supplementary characters.
>
> Right; I changed the code in NativeLibraries.c to pass down true UTF-8 instead of "modified UTF-8". Please, take a look.
I am not sure we can pass non `modified UTF-8` through `JVM_LoadLibrary()`. Probably some VM folks can enlighten here?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4169
More information about the core-libs-dev
mailing list