From: vvv j. <vv...@ya...> - 2012-06-06 17:30:20
|
Hi log4cplus-devel Team Regarding Unicode support, I impemented a null codeset and imbued to file stream as mentioned in the url (http://forums.codeguru.com/showpost.php?p=1741409&postcount=8) in FileAppender file in FileAppender::open method. Also changed the open mode of stream with binary option enabled in FileAppender file. Please let me know if the above approach has any issues. Thanks J.Viswanath ________________________________ From: vvv jjj <vv...@ya...> To: Václav Zeman <vha...@gm...> Cc: "log...@li..." <log...@li...> Sent: Friday, 1 June 2012 10:21 PM Subject: Re: [Log4cplus-devel] Unicode Text Logging Hi log4cplus Devel Team, Thanks Václav Zeman for the detailed explanation. I understood that the problem is not with log4cplus library but it is the behavior of stream in c++. I will try the deriving the FileAppender and check the output or may be I change the code in log4cplus as I'm using both RollFileAppender and DailyRollFileAppender. Regarding the 2nd options imbue I'm using Visual Studio 2008, so need to check if that options work or not. Thanks again to log4cplus team for giving good support. Regards J.Viswanath ________________________________ From: Václav Zeman <vha...@gm...> To: vvv jjj <vv...@ya...> Cc: log...@li... Sent: Friday, 1 June 2012 6:52 PM Subject: Re: [Log4cplus-devel] Unicode Text Logging On 31 May 2012 19:21, Václav Zeman wrote: > On 05/31/2012 05:46 PM, vvv jjj wrote: >> Hi log4cplus Devel Team, >> >> Thanks Václav Zeman. >> >> I gave Unicode text directly in the cpp file. (Ex: CString str = >> _T("Ω⅓∂₤◊");) >> The file is saved with unicode support (the default yes button when >> Unicode file is saved in Visual Studio 2008). The configuration used >> is Debug Unicode dynamic library. >>[...] I have reproduced your problem on Windows as well. The problem is Windows problem with its code pages. Even though you are using the Debug_Unicode (or Release_Unicode) configuration, which means that the output stream is std::wfstream, the output file is always using chars (not wchar_ts). If you insist on logging characters outside of your Windows code page, then you are unfortunately (nearly) out of luck for 1.0.4.1. The best way to work around this for 1.0.4.1 would be to derive your own appender from *FileAppender that you use and either (1) override its append() member function to do, either wchar_t -> UTF-8 (or any other translation) on the fly, or, if you can use Visual Studio 2010, (2) imbue the underlying file stream with, e.g., std::codecvt_utf8<tchar, 0x10FFFF, static_cast<std::codecvt_mode>(std::consume_header | std::little_endian)> facet. For trunk and 1.1.x branches you can do (2) using imbue() member function on *FileAppender. -- VZ ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Log4cplus-devel mailing list Log...@li... https://lists.sourceforge.net/lists/listinfo/log4cplus-devel |