Since I have been doing the Web page, in order to facilitate the MyEclipse all the code has been changed to UTF-8, the project's default code has also changed to UTF-8.
Today, I accidentally found that I could not enter Chinese ... It's going to be garbled.
Scanner cin = new Scanner (system.in); System.out.println (Cin.next ());
Baidu later learned that, because the Chinese system by default with GBK encoding (including Java input console), and its own project has adopted the UTF-8, so it will lead to garbled. So, just change the console's code.
- Select Run configurations If you always use Run to start, otherwise choose Debug configurations
- Open to enter this interface, note that at this point the left is selected is the current item to be changed, and then point to the right of the common label
- When you open the Common tab, you'll find an entry: Console Encoding
This is inherited from the project I set before the encoding method: Utf-8, that is, the problem is caused by garbled
- That being the case, then we change the code, changing it to GBK, as follows:
Save when you're done with the changes.
MyEclipse Console garbled problem