Skip to content

Commit 32052ec

Browse files
committed
Polishing
1 parent 2a7763d commit 32052ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/org/mybatis/scripting/thymeleaf/ThymeleafLanguageDriver.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018 the original author or authors.
2+
* Copyright 2018-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@
3636
import java.io.InputStream;
3737
import java.io.InputStreamReader;
3838
import java.lang.reflect.InvocationTargetException;
39+
import java.nio.charset.Charset;
3940
import java.nio.charset.StandardCharsets;
4041
import java.util.Optional;
4142
import java.util.Properties;
@@ -104,7 +105,9 @@ private ITemplateEngine createDefaultTemplateEngine() {
104105
try (InputStream in = Resources.getResourceAsStream(
105106
System.getProperty("mybatis-thymeleaf.config.file", "mybatis-thymeleaf.properties"))) {
106107
if (in != null) {
107-
String encoding = System.getProperty("mybatis-thymeleaf.config.encoding", StandardCharsets.UTF_8.name());
108+
Charset encoding = Optional.ofNullable(System.getProperty("mybatis-thymeleaf.config.encoding"))
109+
.map(Charset::forName)
110+
.orElse(StandardCharsets.UTF_8);
108111
try (InputStreamReader inReader = new InputStreamReader(in, encoding);
109112
BufferedReader bufReader = new BufferedReader(inReader)) {
110113
properties.load(bufReader);

0 commit comments

Comments
 (0)