search

Home  >  Q&A  >  body text

java - Win10下 idea的编码设置成了UTF-8,但是返回时乱码显示,哪里有问题??



如图,我在启动服务的时候,命令行是乱码的。调试的时候,返回值是乱码的,所以前台显示的时候,也就乱码显示了。

我的setting设置的都是UTF-8,我哪里配置错了??

怪我咯怪我咯2812 days ago749

reply all(4)I'll reply

  • 黄舟

    黄舟2017-04-18 10:54:30

    The Windows host CMD encoding is GBK. Please pay attention to this

    reply
    0
  • 迷茫

    迷茫2017-04-18 10:54:30

    I have never used idea. There are two types of garbled characters on the internet: editor garbled characters and console garbled characters. Does your info belong to editor garbled characters or console garbled characters? , and the font in color&fonts has also been changed to utf-8

    I see that the picture you added is garbled on the console: Online solution
    The console output is garbled. To solve this problem, just add -Dfile.encoding=UTF-8 to the VM options in configurations and it will be solved

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:54:30

    ------------------------------------------------- ------------correct answer------------------------------------ ---------------
    Okay, it's a problem with my project.
    My project is a gradle project, so I need to add the following configuration in build.gradle:
    compileJava.options.encoding = 'UTF-8'
    compileTestJava.options.encoding = 'UTF-8'

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:54:30

    Modifying the file encoding will not affect the console output.
    Have the questioner modified IDEA字体? If so, you can try changing it to the default value.

    reply
    0
  • Cancelreply