diff --git a/sampler/src/main/java/atlantafx/sampler/theme/CSSFragment.java b/sampler/src/main/java/atlantafx/sampler/theme/CSSFragment.java index 6cd7b7a..bf3fe93 100644 --- a/sampler/src/main/java/atlantafx/sampler/theme/CSSFragment.java +++ b/sampler/src/main/java/atlantafx/sampler/theme/CSSFragment.java @@ -3,10 +3,11 @@ package atlantafx.sampler.theme; import javafx.scene.layout.Region; -import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.Objects; +import static java.nio.charset.StandardCharsets.UTF_8; + public final class CSSFragment { private static final String DATA_URI_PREFIX = "data:base64,"; @@ -51,6 +52,6 @@ public final class CSSFragment { } public String toDataURI() { - return DATA_URI_PREFIX + new String(Base64.getEncoder().encode(css.getBytes()), StandardCharsets.UTF_8); + return DATA_URI_PREFIX + new String(Base64.getEncoder().encode(css.getBytes(UTF_8)), UTF_8); } } diff --git a/sampler/src/main/java/atlantafx/sampler/theme/SamplerTheme.java b/sampler/src/main/java/atlantafx/sampler/theme/SamplerTheme.java index 6aff0b3..562d4f8 100644 --- a/sampler/src/main/java/atlantafx/sampler/theme/SamplerTheme.java +++ b/sampler/src/main/java/atlantafx/sampler/theme/SamplerTheme.java @@ -106,7 +106,7 @@ public final class SamplerTheme implements Theme { // classpath resources are static, no need to parse project theme more than once if (colors != null) { return colors; } - try (var br = new BufferedReader(new InputStreamReader(file.getInputStream()))) { + try (var br = new BufferedReader(new InputStreamReader(file.getInputStream(), UTF_8))) { colors = parseColors(br); }