abumq / easyloggingpp

C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
MIT License
3.75k stars 918 forks source link

how to output the SBC case character string #370

Open charlessoft opened 8 years ago

charlessoft commented 8 years ago

like ‘【’ or chinese charactr string, LOG(INFO)<< L'【' ; doesn't work

thanks

drinkmystery commented 8 years ago

Just use LOG(INFO)<< '【'

Its related to 3 things.

  1. Your source file's encoding. You can store your source file in utf-8, utf-8 with BOM or gb2312/cp936. These encodings all support ‘【’ or chinese charactr string.
  2. Your complier's option. -finput-charset and -fexec-charset for gcc. /source-charset and /execution-charset for msvc. (https://msdn.microsoft.com/en-us/library/mt708818.aspx?f=255&MSPPError=-2147217396)
  3. Your viewer's option. Console on Windows has a codepage option. Most text viewer program has encode options.

For example, i use VS2015 on win10 chinese simplified version. The system default codepage is cp936/gb2312.

  1. I store source files in cp936.
  2. I use default setting of msvc.(execution-charset is cp936)
  3. I view the output in windows console and notepad++.

It just works fine with the code "LOG(INFO)<< '【'". d 6i5cvsy6rzdf6t9at62dn