当前位置:网站首页>IDEA file encoding modification
IDEA file encoding modification
2022-08-04 23:50:00 【Cham valley Gooyuit】
Original link: https://blog.csdn.net/cgl125167016/article/details/78666432
IDEA Chinese Tutorial: https://github.com/judasn/IntelliJ-IDEA-Tutorial/
BrotherThank you to these two bloggers~
This article introduces how to modify the file encoding in IntelliJ IDEA, refer to the IntelliJ IDEA Simplified Chinese special tutorial, students who are good in English can view the official English documentation
File encoding modification
IntelliJ IDEA can modify the encoding of the project file under File -> Settings -> Editor -> File Encoding in the menu
Write picture description here
The default global encoding of IDE is UTF-8, and Project Encoding will be GBK of the operating system by default, which is generally modified to UTF-8
IntelliJ IDEA can set special encoding settings for Properties files, and it is also recommended to change toUTF-8, one of the key points is the property Transparent native-to-ascii conversion, which is generally checked, otherwise the comments in the Properties file will not be displayed in Chinese.
IntelliJ IDEA supports setting the encoding for the entire Project.In addition, it 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 back up the files before conversion, otherwise the conversion process may become garbled and cannot be restored
In addition, the individual files ofThe encoding can also be set like this
Write picture description here
may pop up such a pop-up box
Write picture description here
Reload means to reload with the new code, the new code will not be saved to the file
Convert means to use the new code to convert, the new code will be saved to the file
The code file containing Chinese, Convert 2Xf2E6aEU7n685eHEbXGYHrmWn2y7a62UWBrtZzodVdD
Compilation errors caused by encoding problems
Compilation error: cannot find symbols, unterminated string literals, etc. Solutions:
Because UTF-8 encoded files have BOM and no BOM, 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 IDEAThis problem is often encountered when developing Eclipse projects.Mainly because the compiler of Eclipse is Eclipse, which supports the compilation of files with BOM.Therefore, the solution is to perform BOM removal for this file
To remove BOM in batches, you can Google: batch removal of BOM, batch conversion without BOM and other keywords, various solutions have been provided on the Internet
If the above problems cannot be solvedSolved, and you also 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: there is a problem with the project configuration file.The configuration file of 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 output garbled characters
IDEA's unified console coding control, find idea.exe.vmoptions in your idea.bin or 64 directory or add -Dconsole.encoding=UTF-8 in 64. Note that it is console reference: https://stackoverflow.com/questions/35231291/intellij-idea-incorrect-encoding-in-console-output
If your Tomcat console outputs garbled characters, and you have ensured that the console font settings in this article contain Chinese, you can also try adding: -Dfile.encoding to the VM parameters of Tomcat=UTF-8, as shown in the figure
Write picture description here
边栏推荐
- [QNX Hypervisor 2.2用户手册]10.4 vdev hpet
- What is next-generation modeling (with learning materials)
- MVCC是什么
- .net (C#) get year month day between two dates
- MYS-6ULX-IOT 开发板测评——使用 Yocto 添加软件包
- [Happy Qixi Festival] How does Nacos realize the service registration function?
- 未上市就“一举成名”,空间媲美途昂,安全、舒适一个不落
- The role of @ Import annotations as well as how to use
- uniapp 分享功能-分享给朋友群聊朋友圈效果(整理)
- 为何越来越多人选择进入软件测试行业?深度剖析软件测试的优势...
猜你喜欢

407. 接雨水 II

为何越来越多人选择进入软件测试行业?深度剖析软件测试的优势...

KT148A voice chip ic working principle and internal architecture description of the chip

加解密在线工具和进制转化在线工具

Vscode连接远程服务器(一套配置成功)

Flutter启动流程(Skia引擎)介绍与使用

【SSR服务端渲染+CSR客户端渲染+post请求+get请求+总结】

NebulaGraph v3.2.0 Release Note,对查询最短路径的性能等多处优化

MySQL增删改查基础
![[Happy Qixi Festival] How does Nacos realize the service registration function?](/img/df/5793145da45bc80d227b0babfac914.png)
[Happy Qixi Festival] How does Nacos realize the service registration function?
随机推荐
PZK学C语言之字符串函数(一)
ClickHouse 二级索引
uniapp横向选项卡(水平滚动导航栏)效果demo(整理)
容联云发送短信验证码
中日颜色风格
KT148A语音芯片怎么烧录语音进入芯片里面通过串口和电脑端的工具
Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
mysql基础
话题 | 雾计算和边缘计算有什么区别?
小黑leetcode之旅:95. 至少有 K 个重复字符的最长子串
Security software Avast and Symantec NortonLifeLock merge with UK approval, market value soars 43%
d枚举生成位
【LeetCode】双指针题解汇总
.net (C#) get year month day between two dates
uniapp 分享功能-分享给朋友群聊朋友圈效果(整理)
Privacy Computing Overview
10 个关于 Promise 和 setTimeout 知识的面试题,通过图解一次说透彻
【七夕快乐篇】Nacos是如何实现服务注册功能的?
为何越来越多人选择进入软件测试行业?深度剖析软件测试的优势...
Pytorch分布式训练/多卡/多GPU训练DDP的torch.distributed.launch和torchrun