RFR: 8195129: System.load() fails to load from unicode paths [v3]

Maxim Kartashev github.com+28651297+mkartashev at openjdk.java.net
Thu Jun 3 06:59:14 UTC 2021


On Tue, 1 Jun 2021 18:24:05 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Maxim Kartashev has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Coding style-related corrections.
>>  - Corrected the test to use Platform.sharedLibraryExt()
>
> 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.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4169


More information about the core-libs-dev mailing list