I use springboot3, which doesn't seem to support outputting Chinese. I have configured VM to use UTF-8 springboot3 springboot(2)

Comment From: pruidong

JVM arguments you need to use:

-Dfile.encoding=GBK

idea_run_chinese

Comment From: jianjiaF

Yeah!If I use 2.6.6 version of springboot and jdk17, it will not be like this, but if I use jdk18, it will be garbled; Using springboot and jdk18 of version 3.0.0 will cause garbled code, but using jdk17 will not cause garbled code.But jdk18 seems to support Chinese by default.

Comment From: pruidong

If you are not using JDK18, you can ignore this one:

I suspect that this problem is caused by JDK modifying the default encoding, but I haven't researched this problem yet. (JDK18: https://openjdk.java.net/jeps/400)

If it still doesn't display properly, you need to check your IDEA file encoding:

idea_file_encoding_setting

Comment From: pruidong

Yeah!If I use 2.6.6 version of springboot and jdk17, it will not be like this, but if I use jdk18, it will be garbled; Using springboot and jdk18 of version 3.0.0 will cause garbled code, but using jdk17 will not cause garbled code.But jdk18 seems to support Chinese by default.

This is due to a change in JDK18, usually I recommend you to use a long-term supported version of the JDK in production, such as: JDK8, JDK11, JDK17.

Comment From: jianjiaF

Yeah!If I use 2.6.6 version of springboot and jdk17, it will not be like this, but if I use jdk18, it will be garbled; Using springboot and jdk18 of version 3.0.0 will cause garbled code, but using jdk17 will not cause garbled code.But jdk18 seems to support Chinese by default.

This is due to a change in JDK18, usually I recommend you to use a long-term supported version of the JDK in production, such as: JDK8, JDK11, JDK17.

Yeah!My production environment uses jdk17, but I like to try something new, so I use jdk18 to create projects, which causes this problem. At present, it should be the problem of jdk18, but I don't know how to solve it.

Comment From: pruidong

Yeah!If I use 2.6.6 version of springboot and jdk17, it will not be like this, but if I use jdk18, it will be garbled; Using springboot and jdk18 of version 3.0.0 will cause garbled code, but using jdk17 will not cause garbled code.But jdk18 seems to support Chinese by default.

This is due to a change in JDK18, usually I recommend you to use a long-term supported version of the JDK in production, such as: JDK8, JDK11, JDK17.

Yeah!My production environment uses jdk17, but I like to try something new, so I use jdk18 to create projects, which causes this problem. At present, it should be the problem of jdk18, but I don't know how to solve it.

JVM arguments you need to use:

-Dfile.encoding=GBK

Comment From: jianjiaF

Yeah!If I use 2.6.6 version of springboot and jdk17, it will not be like this, but if I use jdk18, it will be garbled; Using springboot and jdk18 of version 3.0.0 will cause garbled code, but using jdk17 will not cause garbled code.But jdk18 seems to support Chinese by default.

This is due to a change in JDK18, usually I recommend you to use a long-term supported version of the JDK in production, such as: JDK8, JDK11, JDK17.

Yeah!My production environment uses jdk17, but I like to try something new, so I use jdk18 to create projects, which causes this problem. At present, it should be the problem of jdk18, but I don't know how to solve it.

JVM arguments you need to use:

-Dfile.encoding=GBK

Oh! thank you!

Comment From: snicoll

All of this is outside spring boot's control, closing.