Make sure to use utf-8 for bookmark reading as well as writing (#253)

This commit is contained in:
Raven Szewczyk authored and GitHub committed 2022-05-27 19:38:54 +02:00
1 parent 8f7d698e7d
commit ba77a63545
2 files changed
+10 -8

No files matched your search

@@ -32,6 +32,7 @@ import java.io.OutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -547,7 +548,7 @@ public class BookmarkPanel extends PanelWidget
}
try (FileOutputStream output = new FileOutputStream(bookmarkFile)) {
IOUtils.writeLines(strings, "\n", output, "UTF-8");
IOUtils.writeLines(strings, "\n", output, StandardCharsets.UTF_8);
} catch (IOException e) {
NEIClientConfig.logger.error("Filed to save bookmarks list to file {}", bookmarkFile, e);
}
@@ -568,9 +569,9 @@ public class BookmarkPanel extends PanelWidget
}
List<String> itemStrings;
try (FileReader reader = new FileReader(bookmarkFile)) {
try (FileInputStream reader = new FileInputStream(bookmarkFile)) {
NEIClientConfig.logger.info("Loading bookmarks from file {}", bookmarkFile);
itemStrings = IOUtils.readLines(reader);
itemStrings = IOUtils.readLines(reader, StandardCharsets.UTF_8);
} catch (IOException e) {
NEIClientConfig.logger.error("Failed to load bookmarks from file {}", bookmarkFile, e);
return;