From 8946531050dc839fa9ab678433df2f7bead3b548 Mon Sep 17 00:00:00 2001 From: "eric.jarosch" Date: Wed, 23 Sep 2026 14:31:20 +0200 Subject: [PATCH] fix: default encoding for test cases on windows `new String(byte[])` uses `Charset.defaultCharset()` as the encoding. This only works on machines where the default charset is UTF-8, because all of the test.properties files are encoded using UTF-8. Consequently, 21 tests fail on windows, because here the default charset is windows-1252, while the test.properties files are still encoded using UTF-8, causing a mismatch to be detected by the tests. The fix is to explicitly use the correct encoding. --- src/test/java/org/codejive/properties/TestProperties.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/codejive/properties/TestProperties.java b/src/test/java/org/codejive/properties/TestProperties.java index 10ad235..d5398bc 100644 --- a/src/test/java/org/codejive/properties/TestProperties.java +++ b/src/test/java/org/codejive/properties/TestProperties.java @@ -4,6 +4,7 @@ import java.io.*; import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -795,6 +796,6 @@ private Path getResource(String name) throws URISyntaxException { } private String readAll(Path f) throws IOException { - return new String(Files.readAllBytes(f)); + return new String(Files.readAllBytes(f), StandardCharsets.UTF_8); } }