Skip to content

Commit

Permalink
Use UTF-8 encoding when reading multilingual JSON templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Kliuchnikau committed Aug 5, 2024
1 parent 19da6db commit 008cb94
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

/**
* @author kadehar
Expand All @@ -36,7 +37,7 @@ public <T> T parseFile(File file, Class<T> clazz) throws FileNotFoundException {
public <T> T parseResource(String resourcePath, Class<T> clazz) throws IOException {
log.info("Mapping resource at path {} to {} object", resourcePath, clazz.getSimpleName());
try (InputStream inputStream = RESOURCES_UTIL.getResourceAsStream(resourcePath);
InputStreamReader inputStreamReader = new InputStreamReader(inputStream)) {
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
return GSON.fromJson(inputStreamReader, clazz);
}
}
Expand Down

0 comments on commit 008cb94

Please sign in to comment.