Windows command line multi-language output

Source: Internet
Author: User

Multi-language support is an old problem that involves all aspects, including operating systems, character sets,ProgramAnd so on. Can the command line fully support multiple languages? The following are some attempts to break some of the established concepts of errors.

Visual Studio does not support Unicode by default.CodeText and resource.

If vs is doing so perfectly, what should we do with the command line compilation structure and various third-party auxiliary development work? By default, VS is bound to the language environment of. For example, if I use Chinese VS 2005 in English Vista x64, the default vs region is only two, "Chinese" or "Same as windows ". In this environment, most of the new Code text encoding is local code, such as GBK, which is not Unicode at all. Therefore, Unicode is not supported at the underlying layer. In Linux, the text editor and code: blocks are utf8 by default. As you can imagine, in a multi-regional multi-language cooperation software development environment, How troublesome is vs's "special.

The resource Editing System of vs supports Unicode display. By default, strings are not compiled into the program as Unicode.

Yes, you are not mistaken. I was almost cheated by this.

Add a string and switch to the German input method and enter "Wörter". "ö" is a character of cp1252, not a Chinese cp936 character. Then load the data to the program using loadstringw (to prevent the program from performing the conversion by itself ).

0057 003f 0072 0074 0065 0072

3f is the "?", One question mark in ASCII is not the one we want. Then open the resource file in code mode to see whether it is so miserable,

At first, I thought it was because setlocal was not configured. After repeated tests, I finally found that vs had converted itself into a question mark when inserting the program. Is this a bug in? Or FEA?

After knowing this problem, we can solve it by adding L before all strings to convert them into wide strings. However, once you press Ctrl + S to save it, vs cleverly removes l, which is really not stupid! After comparing wxWidgets, people have evolved to XML-based data files XRC. However, it is estimated that this feature of VS has lasted for many years and MS has not been fixed yet.

Never think of the. NET era. The old Win32 and MFC programs do not need to be maintained. In fact, many programs are still not virtual machines, so we need to take care of them more. For example, 3 DSMAX, The string_table looks scary ......

Windows command line uses the local character set by default. If you didn't call chcp 1252 to switch to the German character set, the character cannot be printed even if the hexadecimal display is correct. Let's switch the character set in a down-to-earth manner.

Or everyone can write an English program.

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.