Application.yml or application.properties configuration file garbled problem

1. Idea writes the application.yml configuration file and uses Chinese comments. It is written well, but after running the project, garbled characters appear, as follows:
Insert image description here

2. Solution:
Set the file encoding method to UTF-8
File-Setting-Editor-File Encodings

Insert image description here
Run the project again and the garbled code problem will be solved.

3. Description of garbled code problem
Generally speaking, garbled code means that the encoding format and decoding format of a file are inconsistent, resulting in garbled code.

  • If there is an a.txt file, when you write this file, the encoding format is UTF-8, and save it after writing.
  • However, if you open the software that reads a.txt files and the default decoding format is GBK format, garbled characters will appear.

That is to say, the encoding format (UTF-8) of a file and the decoding format (UTF-8) used to read the file must be consistent to avoid garbled characters.

Guess you like

Origin blog.csdn.net/qq_45432276/article/details/132018076