ArticleDirectory
- Solution
- Displayed correctly after resolution
- Legacy problems
InIronruby-write automated test scriptsThe result displayed in netbeans is correct, and garbled characters are displayed in DOS, as shown in:
In actual application, an automated test is performed on a bat file, instead of under netbeans, which is obviously a text encoding problem. What settings should I have to set to display Chinese Characters in DOS. I introduced the UTF-8 format used by ruby files in the ironruby-file encoding, So I collected an article on how to display UTF-8 characters in the DOS window and found a solution.
Solution
The following describes how to set the DOS window to display UTF-8 characters.
- Open the cmd.exe command line window.
- Change by using the chcp commandCodePage, UTF-8 code page is 65001
Chcp 65001
- After this operation is performed, the code page is turned into a UTF-8. However, you also need to modify the font of window properties to correctly display UTF-8 characters, right-click on the command line title bar, choose [properties]-[font ], change the font to the true type font lucida console and click OK to apply the property to the current window. You can keep this setting so that you do not need to set it next time.
- After the above operations, the displayed content may be incomplete. In this case, we can minimize the number and then maximize the command line window.
Displayed correctly after resolution
After the modification, execute ironruby-when you compile the calculator automation script in the automation test script, it is displayed as follows:
Legacy problems
Although it is correctly displayed, after setting it, double-clicking the BAT file or executing the BAT file in the CMD window does not respond. No one knows how to solve this problem?
Lostinyoureyes provides the following solutions:Chcp 65001> NUL & ir.exe-ku-X: showclrexceptions testcalc. RB & pause
You are welcome to reprint it. Please note: Reprinted fromZhou jingen [http://zhoujg.cnblogs.com/]