Skip to content

Commit

Permalink
Wrap InputStream with Reader and set UTF-8 charset
Browse files Browse the repository at this point in the history
  • Loading branch information
kenfinnigan committed Nov 11, 2019
1 parent 3e791ef commit 91c8850
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package io.smallrye.config.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -49,9 +50,9 @@ public static Map<String, String> propertiesToMap(Properties properties) {
}

public static Map<String, String> urlToMap(URL locationOfProperties) throws IOException {
try (InputStream in = locationOfProperties.openStream()) {
try (InputStreamReader reader = new InputStreamReader(locationOfProperties.openStream(), StandardCharsets.UTF_8)) {
Properties p = new Properties();
p.load(in);
p.load(reader);
return ConfigSourceUtil.propertiesToMap(p);
}
}
Expand Down

0 comments on commit 91c8850

Please sign in to comment.