Skip to content

Commit 35b6c49

Browse files
committed
Merge branch '3.3.x'
Closes gh-43062
2 parents 7a4b7f9 + 317d943 commit 35b6c49

File tree

1 file changed

+16
-1
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven

1 file changed

+16
-1
lines changed

spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.io.IOException;
2121
import java.net.MalformedURLException;
2222
import java.net.URL;
23+
import java.nio.charset.Charset;
24+
import java.nio.charset.UnsupportedCharsetException;
2325
import java.nio.file.Files;
2426
import java.nio.file.Path;
2527
import java.util.ArrayList;
@@ -452,7 +454,20 @@ static String format(String key, String value) {
452454
record ArgFile(Path path) {
453455

454456
private void write(CharSequence content) throws IOException {
455-
Files.writeString(this.path, "\"" + escape(content) + "\"");
457+
Files.writeString(this.path, "\"" + escape(content) + "\"", getCharset());
458+
}
459+
460+
private Charset getCharset() {
461+
String nativeEncoding = System.getProperty("native.encoding");
462+
if (nativeEncoding == null) {
463+
return Charset.defaultCharset();
464+
}
465+
try {
466+
return Charset.forName(nativeEncoding);
467+
}
468+
catch (UnsupportedCharsetException ex) {
469+
return Charset.defaultCharset();
470+
}
456471
}
457472

458473
private String escape(CharSequence content) {

0 commit comments

Comments
 (0)