Sublime support Utf-8 C source code method, other garbled case reference.

Source: Internet
Author: User

Since the use of sublime has been using SUBLIME+GCC to write C programs, but there is a problem is disturbing people.

Generally new source file is Utf-8 encoding mode, but the Windows console is GBK encoding (sublime console cannot input, then give up, and call win cmd), Chinese display will cause garbled.

And win to modify the key value of the registry to support Utf-8, but after the modification, it will cause some trouble, Java will be garbled.

1.sublime using other console programs (unsuccessful, mentally wounded,, not)

2. In Baidu found a way, is to input commands in the console, temporarily modified to support Utf-8

CHCP              // View the code page of the current console 65001        // change to Unicode code page

Think of modifying sublime compiled system configuration file, write a few more commands, before running the program to add Chcp 65001 in.

Tossing a few hours, incidentally understood some commands (below).

dir       // dir/dir//dir//           You can use cmd/? To view help information.

Talk less, attach the configuration code I changed.

1 {2 "cmd": ["GCC","${file}","- o","${file_path}/${file_base_name}"],3 "File_regex":"^(.. [^:]*]:([0-9]+):? ([0-9]+)?:? (.*)$",4 "Working_dir":"${file_path}",5 "selector":"source.c",6 7 "variants":8 [9 {Ten "name":"Run", One "cmd": ["cmd","/ C","GCC","${file}","- o","${file_path}/${file_base_name}","&&","Start","cmd","/ C","chcp 65001 && clear && ${file_path}/${file_base_name} && Pause"]} A ] -}

Line 11th && after cmd/c ..... is to chcp 65001 then clear (clear screen) finally execute the target program.

Also note that when you cannot display Chinese, change the console default font and adjust it yourself.

Test for changes to change the 11th line to

 "cmd": ["cmd","/ C","GCC","${file}","- o","${file_path}/${file_base_name}","&&","Start","cmd","/k","chcp 65001 && clear && ${file_path}/${file_base_name} && Pause"]}

Only changed the/C to/k

After the test is finished, change the/k to/C.

A compiled system configuration file with two C is included. Put it under the sublime text\data\packages\user\.

Download

Sublime support Utf-8 C source code method, other garbled case reference.

Related Article

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.