Skip to content

Commit f35af88

Browse files
committed
Merge pull request #10565 from thiagohirata/fix/#10564
* pr/10565: Update OriginTrackedPropertiesLoader to ISO 8859-1
2 parents 8e030d4 + 85e71f2 commit f35af88

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
*
3838
* @author Madhura Bhave
3939
* @author Phillip Webb
40+
* @author Thiago Hirata
4041
*/
4142
class OriginTrackedPropertiesLoader {
4243

@@ -154,7 +155,7 @@ private static class CharacterReader implements Closeable {
154155

155156
CharacterReader(Resource resource) throws IOException {
156157
this.reader = new LineNumberReader(
157-
new InputStreamReader(resource.getInputStream()));
158+
new InputStreamReader(resource.getInputStream(), "8859_1"));
158159
}
159160

160161
@Override

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/env/OriginTrackedPropertiesLoaderTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,12 @@ public void getListProperty() throws Exception {
228228
assertThat(getLocation(mango)).isEqualTo("27:1");
229229
}
230230

231+
@Test
232+
public void getPropertyWithISO88591Character() throws Exception {
233+
OriginTrackedValue value = this.properties.get("test-iso8859-1-chars");
234+
assertThat(getValue(value)).isEqualTo("æ×ÈÅÞßáñÀÿ");
235+
}
236+
231237
private Object getValue(OriginTrackedValue value) {
232238
return (value == null ? null : value.getValue());
233239
}

spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/env/test-properties.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ test-property-value-comment=foo \
3737
!bar #foo
3838
test-multiline-immediate-bang=\
3939
!foo
40+
41+
#test ISO 8859-1
42+
test-iso8859-1-chars=æ×ÈÅÞßáñÀÿ

0 commit comments

Comments
 (0)