From c63728986e492cd1d3b0ec346c1b15670d7ab544 Mon Sep 17 00:00:00 2001 From: Duckelekuuk Date: Thu, 1 Dec 2022 17:09:18 +0100 Subject: [PATCH] Fixed issue with reading from cache --- src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java b/src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java index 1f12762..23b6c94 100644 --- a/src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java +++ b/src/main/java/com/duckelekuuk/aoc/utils/InputFetcher.java @@ -8,6 +8,7 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; @@ -51,11 +52,11 @@ public static String getInput(Path cachePath, boolean autoFetch, String session, } private static void cacheInput(Path cachePath, int day, String input) throws IOException { - Files.writeString(cachePath.resolve(String.format(CACHE_FILE, day)), input); + Files.writeString(cachePath.resolve(String.format(CACHE_FILE, day)), input, StandardCharsets.UTF_8); } private static String getFromCache(Path cachePath, int day) throws IOException { - return Files.readString(cachePath.resolve(String.format(CACHE_FILE, day))); + return Files.readString(cachePath.resolve(String.format(CACHE_FILE, day)), StandardCharsets.UTF_8); } private static boolean isCached(Path cachePath, int day) {