Display Chinese on Windows Console

Source: Internet
Author: User

Prepare the serverProgramUse Unicode to write

When compiling Ace, I added

# Define ace_has_wchar

# Define ace_use_wchar

Write a hello World applet. The result is displayed on the console that no Chinese characters are displayed. Soon, it is found that the console attribute must be set before Unicode characters can be properly displayed.

 

CodeAs follows:

 

Include "stdafx. H"
# Include "ACE/OS. H"
# Include "ACE/log_msg.h"
# Include <mmsystem. h>
# Include <locale. h>
Int _ tmain (INT argc, _ tchar * argv [])
{
Setlocale (lc_all, "CHS"); // ******* set local attributes ********** for (INT I = 0; I <100; I ++)
{
Int cur = ace_ OS: gettimeofday (). msec ();
_ Tprintf (ace_text ("Hello world, are you Unicode today? [% D]/n "), cur );
Outputdebugstr (ace_text ("Hello world, are you Unicode today? /N "));
Ace_debug (lm_info, ace_text ("Hello Ace, are you Unicode today? /N ")));
Ace_ OS: Sleep (1 );
}
Return 0;
}

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.