# 解决goland的中文乱码问题

编辑器配置:

Image-2020-08-12-004.png

goland JVM配置:

Help -> Edit Custom VM Options添加

-Dfile.encoding=UTF8

Image-2020-08-12-005.png

另外,还推荐使用editorconfig来为整个项目进行配置:在项目根目录下添加:.editorconfig,内容可以大致如下:

# http://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true

[*.yaml]
indent_size = 2

[*.yml]
indent_size = 2

[*.xml]
indent_size = 2
max_line_length = 1000

[*.json]
indent_size = 2
max_line_length = 1000

# https://github.com/Dreamscapes/makefiles/blob/master/.editorconfig
[{Makefile,**.mk}]
indent_style = tab

TIP

Jetbrains家的其他编辑器应该也一样