I need to be able to use utf-8-encoded strings with log4cxx. I can print the strings just fine with std::cout
(the characters are displayed correctly). Using log4cxx, i.e. putting the strings into the LOG4CXX_DEBUG()
macro with a ConsoleAppender
will output "??" instead of the special character. I found one solution:
LOG4CXX_DECODE_CHAR(logstring, str);
LOG4CXX_DEBUG(logstring);
where str
is my input string, but this does not work. Anyone have an idea how this might work? I google'd around a bit, but I couldn't find anything useful.
You can use
setlocale(LC_CTYPE, "UTF-8");
to set only the character encoding, without changing any other information about the locale.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With