On Oct 30, 2007, at 2:16 PM, Jessica Lin wrote:
I want to use Chainsaw to view the log file contains Chinese
character. The log file was recorded by using FileAppender which I
defined the endoding as “UTF-8”. Here is part of my
log4j.properties file.
# xml format file appender
log4j.appender.xml=org.apache.log4j.FileAppender
log4j.appender.xml.file=xml.log
log4j.appender.xml.encoding=UTF-8
log4j.appender.xml.append=false
log4j.appender.xml.layout=org.apache.log4j.xml.XMLLayout
Then I use Chainsaw to load “xml.log” file. The Chinese
characters are shown as “ åŠ è¿™ä¸ªåŠŸèƒ½”. The
Original characters are “加这个功能”.
I double checked the “xml.log” which did save as UTF-8 encoding.
The XMLDecoder file Which Chainsaw uses to load XML file also use
UTF-8 encoding.
Can you help me?
Thanks,
Jessica
Looks like Chainsaw (actually the receivers companion that Chainsaw
uses) is broken in how it loads XML documents and loads the document
using the current default encoding for the JVM. I filed a bug
(http://issues.apache.org/bugzilla/show_bug.cgi?id=43736) with more
discussion. Until that gets fixed, a workaround would be to change
the default encoding for the JVM when loading Chainsaw. How to do
that appears to implementation specific. If you are running on Linux
or similar, you could set LC_CTYPE=UTF-8 before launching Chainsaw,
on Windows adding a -Dfile.encoding=UTF-8 to the line launching
Chainsaw might do the trick.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]