Issue Details (XML | Word | Printable)

Key: LOG4NET-22
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Niall Daley
Reporter: Nicko Cadell
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Log4net

XmlLayout allows output of invalid control characters

Created: 11/Apr/05 03:33 AM   Updated: 24/Aug/05 10:31 PM
Return to search
Component/s: Appenders
Affects Version/s: 1.2.9
Fix Version/s: 1.2.10

Time Tracking:
Not Specified

Resolution Date: 24/Aug/05 10:31 PM


 Description  « Hide
XmlLayout allows output of invalid control characters.

Reported by Mike Blake-Knox with additional comments from Curt Arnold.


The XmlLayout encodes the character 0x1e as  using the standard XML numeric character reference.

This character code is in a range which is not allowed to appear in XML 1.0 either as a un-encoded value or as a numeric character reference.

The valid character ranges are defined here in the XML recommendation:
http://www.w3.org/TR/REC-xml/#charsets

They are:

#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Numeric character references are not able to express characters from outside these ranges.

The System.Xml.XmlTextWriter does not verify if the unicode character is valid in XML, but it does encode it as a numeric character reference if it cannot be expressed in the output encoding.

To complicate matters further XML 1.1 does allow further, so called restricted characters, to be included in the output if they are encoded as numeric character references. These ranges are:

[#x1-#x8] | [#xB-#xC] | [#xE-#x1F] | [#x7F-#x84] | [#x86-#x9F]

See http://www.w3.org/TR/2004/REC-xml11-20040204/#charsets for details.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #312309 Wed Aug 24 13:26:38 UTC 2005 niall Fixes for LOG4NET-22 and LOG4NET-44 with associated tests.

Characters that cannot be expressed in XML are now masked with a user specifiable charater.
The message and property values may be base64 encoded if this is undesirable.

The name of the properties node has been fixed to properties rather than global-properties.

PR:
Obtained from:
Submitted by:
Reviewed by:
Files Changed
MODIFY /logging/log4net/trunk/tests/src/log4net.Tests.csproj
MODIFY /logging/log4net/trunk/src/Util/Transform.cs
MODIFY /logging/log4net/trunk/src/Layout/XmlLayoutSchemaLog4j.cs
MODIFY /logging/log4net/trunk/src/Layout/XMLLayoutBase.cs
MODIFY /logging/log4net/trunk/src/Layout/XMLLayout.cs
ADD /logging/log4net/trunk/tests/src/Layout/XmlLayoutTest.cs