public/技术规范/关于文件编码的约定.md

31 lines
949 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 关于文件编码的约定
## Java文件
Java文件均用`UTF-8`编码。
IDEA配置`File -> Settings -> Editor -> File Encodings`,将`Global Encoding`与`Project Encoding`都设为`UTF-8`。
![EncodeSetting](../img/EncodeSetting.jpg)
## Maven工程
Maven工程下设置可以通过`pom.xml`文件配置`properties`。限制项目文件编码。
```xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
</properties>
```
## 前端文件
前端文件均用`UTF-8`编码。
## 数据库编码
MySQL采用`UTF8mb4`编码,该编码需要`MySQL5.5`以上版本才支持,且`MySQL8`以上版本才成为默认编码。因此当`MySQL`版本在8以下的版本需要注意在配置文件中配置其编码。
PostgreSQL采用默认的`UTF-8`编码。