diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java index 3e0e06c1e2b9..9e2bc86e2457 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java @@ -154,7 +154,7 @@ private static class CharacterReader implements Closeable { CharacterReader(Resource resource) throws IOException { this.reader = new LineNumberReader( - new InputStreamReader(resource.getInputStream())); + new InputStreamReader(resource.getInputStream(), "8859_1")); } @Override diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java index 77eff0c05cf2..a869b0d64a58 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java @@ -227,6 +227,12 @@ public void getListProperty() throws Exception { assertThat(getValue(mango)).isEqualTo("Mango"); assertThat(getLocation(mango)).isEqualTo("27:1"); } + + @Test + public void getPropertyWithISO88591Character() throws Exception { + OriginTrackedValue value = this.properties.get("test-iso8859-1-chars"); + assertThat(getValue(value)).isEqualTo("æ×ÈÅÞßáñÀÿ"); + } private Object getValue(OriginTrackedValue value) { return (value == null ? null : value.getValue()); @@ -238,5 +244,4 @@ private String getLocation(OriginTrackedValue value) { } return ((TextResourceOrigin) value.getOrigin()).getLocation().toString(); } - } diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties index 19dabb34fbaf..245f30a11435 100644 --- a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties @@ -37,3 +37,6 @@ test-property-value-comment=foo \ !bar #foo test-multiline-immediate-bang=\ !foo + +#test ISO 8859-1 +test-iso8859-1-chars=æ×ÈÅÞßáñÀÿ \ No newline at end of file