monaco font:IntelliJ IDEA's font and garbled problem settings-Font Tutorial免费ppt模版下载-道格办公

IntelliJ IDEA's font and garbled problem settings

font modification

Theme font modification

Theme font modification

As shown in note 1 above, to modify the theme font of IntelliJ IDEA, you must first check Override default fonts by . By default, IntelliJ IDEA does not recommend modification, but because the fonts are divided into Chinese and non-Chinese, countries that generally use English do not need to worry about garbled characters, but we do.

The aesthetics of fonts are different for everyone, but as mentioned in the previous paragraph, you need to know a prerequisite for font modification here, that is, the font you choose must contain Chinese, such as Microsoft Yahei and Songti, which contain Chinese. And Courier New and Monaco are just pure English fonts.

If the font you choose does not contain Chinese, there may be garbled characters like koukoukoukoukou in many places. For example, if the file name contains Chinese and the font is a Chinese name, it will become koukoukoukoukou.

When modifying the theme font of IntelliJ IDEA, it is not recommended to adjust the font to a large size, because many people encounter such a situation: the display resolution is low, the theme font is large, and some operations in the tool menu of IntelliJ IDEA, Some options in the right-click menu options exceed the resolution display range and cannot be selected. Of course, if you must change the font to a larger size and don’t need a large-resolution display, you can delete some menus that you don’t think you need through Menus and Toolbars of IntelliJ IDEA, but this is generally not recommended.

When you need to pay special attention, if you have installed a new font when you are running IntelliJ IDEA, you must restart IntelliJ IDEA to find the newly installed font in the drop-down list.

Code editing font modification

Code editing font modification

As shown in the above figure 1, the default IntelliJ IDEA cannot modify the font directly on the default code template, you need to save as a copy first, and then you can modify it. This design is also the same in many other settings of IntelliJ IDEA, so if you still see buttons with options such as Copy and Save As, you must think of this design idea.

As shown in Note 2 above, the checked Show only monospaced fonts means to filter and display the monospaced fonts on the system. Since there are not many monospaced fonts on the Windows system, the drop-down fonts that appear when this option is checked are few to choose from. After unchecking, all fonts installed on the system can be displayed.

As shown in note 3 above, the coded fonts are divided into Primary font and Secondary font. When some characters cannot be supported by the first font, the second font will be used for support.

My personal habit: use Monaco for the English font. Since this font does not support Chinese, I set this as the first font, and the second font uses Yahei Consolas Hybrid for support, which contains Chinese. Neither of these two fonts comes with the system, you need to download and install them yourself.

If your first font does not contain Chinese, and the second font contains Chinese, then there will still be such problems in some places, such as Ctrl + Shift + N to search for files, if you enter Chinese It will also become verbal. My personal file names are not many in Chinese, so I tolerate this situation. If you are unwilling to tolerate this situation, then go back to the original requirement: the first font contains Chinese.

Console output font modification

Console output font modification

The figure above shows the font modification of the console output content. There are many newcomers to IntelliJ IDEA who appear garbled characters when doing output because they have not set it here.

The principle of console output font modification is the same as code editing font modification.

File encoding modification

As shown in the mark 1 above, the default encoding of the IDE is UTF-8. Although the default Project Encoding is GBK, I generally recommend changing it to UTF-8.

As shown in the above figure 2, IntelliJ IDEA can perform special encoding settings for the Properties file, and it is generally recommended to change it to UTF-8. One of the key points is the attribute Transparent native-to-ascii conversion.

As shown in mark 3 in the above figure, for the Properties file, the important attribute Transparent native-to-ascii conversion is mainly used to convert ascii, and it must be checked in general, otherwise the comments in the Properties file will not be displayed in Chinese.

As shown in note 4 above, IntelliJ IDEA not only supports encoding for the entire Project, but also supports encoding settings for directories and files. If you want to set the encoding of the directory, there may be a pop-up operation option that requires Convert encoding. It is strongly recommended to make a backup of the file before conversion, otherwise the conversion process may become garbled and cannot be restored.

File encoding modification

As shown in the above figure, you can also click the encoding setting area in the lower right corner to modify the encoding of individual files. If the code content contains Chinese, the operation selection in the demo will pop up.

Reload means to reload with the new encoding, the new encoding will not be saved to the file, and if the file is reopened, the old encoding remains the same.

Convert means to use the new encoding for conversion, the new encoding will be saved to the file, reopen the file, what is the new encoding.

For code files containing Chinese, the Chinese may become garbled after Convert, so please make a backup before converting, otherwise the conversion process may become garbled and cannot be restored.

Compilation errors due to encoding issues

Compile error: cannot find symbol, unterminated string literal, etc. Solutions:

Since UTF-8 encoded files can be divided into BOM and BOM-free, the compiler used by IntelliJ IDEA is javac by default, and this compilation can only compile files without BOM. Many Eclipse users are using IntelliJ IDEA to develop Eclipse projects often encounter this problem. The main reason is that the Eclipse compiler is Eclipse, which supports compiling files with BOM. Therefore, the solution is to remove the BOM for this file.

To remove BOM in batches, you can Google: keywords such as batch removal of BOM, batch conversion without BOM, etc. There are various solutions available on the Internet.

In addition to removing the BOM and setting the IntelliJ IDEA compiler to Eclipse, it is generally not recommended.

If none of the above problems can be solved, and you have confirmed that all configuration encodings of IntelliJ IDEA are UTF-8, and the error file encoding is also UTF-8 without BOM, then there is another possibility that this situation will also occur: project configuration There is a problem with the file. The configuration file of the project encoding is in: /project directory/.idea/encodings.xml. If you can modify this file, you can modify it. If not, delete the entire .idea directory, restart IntelliJ IDEA and reconfigure the project.

Tomcat console outputs garbled characters

Tomcat console outputs garbled characters

If your Tomcat console outputs garbled characters, and you have ensured that the console font setting above this article contains Chinese, you can also try adding: -Dfile.encoding=UTF- to the Tomcat VM parameter 8. If you are a Mac system, it is likely to be needed.

Articles are uploaded by users and are for non-commercial browsing only. Posted by: Lomu, please indicate the source: https://www.daogebangong.com/en/articles/detail/IntelliJ%20IDEAs%20font%20and%20garbled%20problem%20settings.html

Like (810)
Reward 支付宝扫一扫 支付宝扫一扫
single-end

Related Suggestion