The code path calls `String.getBytesNoRepl()`, but it blindly replaces unmappable characters with replacements if the encoder is an `ArrayEncoder`. Changed only to do so if `doReplace` is `true` in `String.encodeWithEncoder()`.
------------- Commit messages: - 8287541: Files.writeString fails to throw IOException for charset "windows-1252" Changes: https://git.openjdk.java.net/jdk/pull/9019/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=9019&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8287541 Stats: 22 lines in 2 files changed: 4 ins; 11 del; 7 mod Patch: https://git.openjdk.java.net/jdk/pull/9019.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/9019/head:pull/9019 PR: https://git.openjdk.java.net/jdk/pull/9019