Recently, I have encountered the issue of Chinese garbled text in the compiler. Although it does not affect the execution of the program, it always feels awkward to see a bunch of garbled text. I have a bit of OCD and always want to fix it!
The reason for this problem is that everyone uses different document encoding methods when developing programs.
For example, in the past two days, I opened a header file for the SJA1000, and it displayed like this.
All you need to do is select the encoding method in KEIL to solve the problem.
You can see that it displays correctly!
However, another problem arises. For example, if the program I originally wrote uses UTF-8 encoding and I need to add a file encoded in ANSI, I can’t just disregard the other files for the sake of this file displaying correctly. So what should I do?
Actually, it’s very simple. Just find a file conversion software to convert it. Which one should I use? It’s quite simple; the Notepad on our computer is a very simple tool that can achieve this functionality.
For example, use Notepad to open your file.
Then, just change the encoding when saving it.
Display both files in KEIL to compare and find that we have achieved our expected requirement, converting an ANSI encoded document to a UTF-8 document.
The same applies in reverse.