Skip to content

Commit

Permalink
Use UTF-8 to load properties file (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
liyuheng55555 authored Apr 7, 2024
1 parent 19b5d6e commit 1c40e10
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.Optional;
import java.util.Properties;
Expand Down Expand Up @@ -134,7 +136,7 @@ private Optional<Properties> loadProperties() {
private Optional<Properties> loadPropertiesFromFile(String filePath) {
try (FileInputStream fileInputStream = new FileInputStream(filePath)) {
Properties properties = new Properties();
properties.load(fileInputStream);
properties.load(new InputStreamReader(fileInputStream, StandardCharsets.UTF_8));
return Optional.of(properties);
} catch (FileNotFoundException e) {
logger.warn("Fail to find config file {}", filePath);
Expand Down

0 comments on commit 1c40e10

Please sign in to comment.