logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Testing log4j with UTF-16
Date Fri, 25 Aug 2006 20:54:47 GMT

On Aug 22, 2006, at 1:57 PM, Kamal Ahmed wrote:

> Hi,
> How is it possible to ignore/skip the first 2 bytes (which is  
> 0xFEFF) "BOM"
> Byte Order Mark, in the class BinaryCompare.java (as copied below)

The UTF-16 test checks the produced log file against an expected log  
file.  The expected log file has a particular byte-order mark  
followed by the log file contents.  That test may be over-reaching by  
assuming that all Java platform implementations implement UTF-16 in  
the same way as the Windows and Linux implementations do.  That goes  
beyond the specified interpretation of UTF-16, but hasn't been  
reported as a problem yet.

If you are failing that particular test, it would be good to know  
what platform and JVM you are using.  If you are failing it, either  
the JVM is not emitting a byte-order mark (which would seem to be a  
bug in the JVM) or the other byte order is used (which would be  
getting caught by writing a test that assumes behavior beyond what is  
in the Java specification).  If it is the latter, then just skipping  
the BOM order mark would not help, since the rest of the document  
would have the bytes switched.

If it is the latter, the test should be changed to either check that  
there is just a legal byte-order mark (either FFFE or FEFF) and  
ignore the rest of the file or sniff the byte-order mark and check  
the rest of the document against the appropriate UTF-16LE.log or  
UTF-16BE.log file.

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message