Solve the Problem of garbled characters and encoding in DOS

Source: Internet
Author: User


Operating System: Windows 7 64-bit installed oracle11g yesterday. It does not restart immediately after installation. when the machine is restarted the next day, it was found that the original boot time was changed from 36 seconds to 1 minute 22 seconds. Today, I suddenly wanted to optimize the boot speed-Stop oralce services and wait for them to be used again. Later I thought about it. It was quite troublesome to stop the service. I just wrote a batch processing command to start and stop oracle services. I think a little more about www.2cto.com, and record every start and stop in the log file (in fact, there is no need on your own machine, after all, it is just a test machine, due to habits, I like to record related operation logs.) I am not very familiar with English, so I wrote a few Chinese words as a comment. When I opened it with sublime text2. when the bat file is written, it is found that Chinese characters are garbled. At that time, I realized that the default encoding in windows is gbk, or it is better to use the UTF-8 encoding, so it is not easy to appear garbled problem. Okay, I changed the file format to UTF-8 encoding for saving. Write the batch processing command, and try the effect first. There is no problem with enabling or stopping the relevant service, but the log records are garbled, and the logs are sweaty. First of all, I think of the dos output is the default encoding system (gbk), my file is written in UTF-8, will certainly be garbled. The idea at that time was to manually set the temporary encoding in the batch processing file for output, but I don't know about it, Baidu, Keyword: Set the encoding in dos, as a result, some people have encountered such a problem, but they only appeared in the PHP project, but I can also borrow it. The original system will have a lot of font code, in the execution of the batch before setting it OK, the command is as follows: chcp 65001 problem solved, 65001 is the UTF-8 code page, the other is as follows: the MS-DOS provides character sets for the following countries and languages: code page description 936 Simplified Chinese (default) 950 traditional Chinese www.2cto.com 65001 UTF-81258 Vietnamese 1257 Boro 1256 Arabic 1255 Hebrew 1254 Turkish 1253 Greek 1252 Latin 1 character (ANSI) 1251 Spanish 1250 Central European language 949 Korean 932 Japanese 874 Thai 850 multilingual (MS-DOS Latin1) 437 MS-DOS American English or above is a special problem encountered in the compilation of batch processing commands, in this record, for future use.
Note: Write the batch processing command I leave a blank line at the top to make chcp 65001 take effect, this should be related to the UTF-8 file with BOM encoding format, I chose a UTF-8 WITH A BOM encoding format saved file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.