[foreign-memaccess+abi] RFR: 8268230: Foreign Linker API & Windows user32/kernel32: String conversion seems broken [v2]

Jorn Vernee jvernee at openjdk.java.net
Tue Jun 15 13:33:04 UTC 2021


> The problem is that we only add a single 0 byte as a null terminator, regardless of the charset used. For wider char sets, more 0 bytes need to be added. For instance, for UTF_16LE two 0 bytes need to be added.
> 
> This patch fixes the issue by adding the null terminator to the Java string, and only then encoding it as a `byte[]`.

Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:

 - Merge branch 'foreign-memaccess+abi' into Windows_String_Encoding
 - Alternative fix: limit char set used to UTF-8 only.

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

Changes: https://git.openjdk.java.net/panama-foreign/pull/554/files
 Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=554&range=01
  Stats: 169 lines in 4 files changed: 65 ins; 94 del; 10 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/554.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/554/head:pull/554

PR: https://git.openjdk.java.net/panama-foreign/pull/554


More information about the panama-dev mailing list