JDK-8325737 : Release Note: `Files.readString` may return incorrect String when UTF-16 or other Charsets
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 22
  • Priority: P2
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2024-02-13
  • Updated: 2024-02-17
  • Resolved: 2024-02-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22Resolved
Related Reports
Relates :  
Description
Strings read with `java.nio.files.Files.readString` may return incorrect strings when decoding with a Charset other than US-ASCII, ISO08859-1, or UTF-8. Reading strings with other multi-byte charsets such as UTF_16 may produce incorrect results.

The issue can be worked around in JDK 22 GA builds by running with `-XX:-CompactStrings` to disable the use of "Compact Strings".

This issue will be fixed in a future update.