logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken <yongk...@gmail.com>
Subject Re: How to write Asian character to file?
Date Tue, 28 Feb 2006 11:11:13 GMT
  What is right syntax if I want use char array variable with wide character?
        char  lc_str[] =  "hello你好hello01";
        logstream << lc_str << LOG4CXX_ENDMSG;  // not work
  since L only can use with literal.
 a fool question, but I just can not figure it out. Hope somebody will tell me.

在 06-2-28,Ken<yongkwai@gmail.com> 写道:
> Thanks you reply so fast. My platform info is:
>  Slackware 10.1.0  gcc (GCC) 3.3.4  Kernel: 2.6.8.1  host system LANG=en_US
>  wide literals in source code is Chinese.
>
>  I added FileAppender, RollingFileAppender and ConsoleAppender to logger,
>  never use setEncoding() call for any appender
>
>  following source code:
>        cout << "hello你好hello01" << endl;
>        lc_logstream << L"hello你好hello02" << LOG4CXX_ENDMSG;
>        lc_logstream << "hello你好hello03"  << LOG4CXX_ENDMSG;
>
>  output from FileAppender and RollingFileAppender are following(there are same)
>  hell?????hello02
>  ????hello03
>
>  output from ConsoleAppender is following
>  hello
>
>  but cout can output the right result on screen.
>  The generated files are plain text file, four question marks taken my
> 2 Chinese literals' place.
>  I thought did I need add some compile options with my test program or
> when build the Log4Cxx lib?
>
Mime
View raw message