When a Java file created with the Atom editor is garbled when executed at the command prompt
When I executed a Java file created with the Atom editor at the command prompt, the characters were garbled!
Development environment: windows8.1, command prompt
Situation explanation
-
- Write Java code "○○ .java" using Atom
- Type "javac 〇〇.java" at the command prompt and compile
-
- Type "java 〇〇" at the command prompt to execute the program
⇒Japanese characters have been garbled! !!
⇒ Even if I did the same thing with Windows Powershell, Japanese characters were garbled! !!
What do you do now? ??
While looking at the following article, I messed with the character code setting of Atom and solved the garbled characters!
↓ ↓ ↓ ↓ ↓
http://www.comp.tmu.ac.jp/tmuner/faq/mac/java.html
☆ Flow of garbled characters elimination ☆
According to the above article, the character code of the command prompt in Windowws is "SJIS", so check the character code of the Atom editor of the file you are editing.
1. It turns out that the character code of the code being edited is UTF-8
2. Change the character code of the code you are editing to SJIS (Shift JIS)
3. Eliminate garbled characters! !!