You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by bo...@apache.org on 2011/09/09 15:01:50 UTC

svn commit: r1167144 - in /logging/log4net/trunk: src/Util/Transform.cs tests/src/Util/TransformTest.cs tests/src/log4net.Tests.vs2003.csproj tests/src/log4net.Tests.vs2008.csproj tests/src/log4net.Tests.vs2010.csproj

Author: bodewig
Date: Fri Sep  9 13:01:49 2011
New Revision: 1167144

URL: http://svn.apache.org/viewvc?rev=1167144&view=rev
Log:
Pass through characters in range #x100-#xd7ff inside XmlFormat.  LOG4NET-229

Added:
    logging/log4net/trunk/tests/src/Util/TransformTest.cs   (with props)
Modified:
    logging/log4net/trunk/src/Util/Transform.cs
    logging/log4net/trunk/tests/src/log4net.Tests.vs2003.csproj
    logging/log4net/trunk/tests/src/log4net.Tests.vs2008.csproj
    logging/log4net/trunk/tests/src/log4net.Tests.vs2010.csproj

Modified: logging/log4net/trunk/src/Util/Transform.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/src/Util/Transform.cs?rev=1167144&r1=1167143&r2=1167144&view=diff
==============================================================================
--- logging/log4net/trunk/src/Util/Transform.cs (original)
+++ logging/log4net/trunk/src/Util/Transform.cs Fri Sep  9 13:01:49 2011
@@ -191,7 +191,10 @@ namespace log4net.Util
 		private const string CDATA_END	= "]]>";
 		private const string CDATA_UNESCAPABLE_TOKEN	= "]]";
 
-		private static Regex INVALIDCHARS=new Regex(@"[^\x09\x0A\x0D\x20-\xFF\u00FF-\u07FF\uE000-\uFFFD]",RegexOptions.Compiled);
+        /// <summary>
+        /// Characters illegal in XML 1.0
+        /// </summary>
+		private static Regex INVALIDCHARS=new Regex(@"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD]",RegexOptions.Compiled);
 		#endregion Private Static Fields
 	}
 }

Added: logging/log4net/trunk/tests/src/Util/TransformTest.cs
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/Util/TransformTest.cs?rev=1167144&view=auto
==============================================================================
--- logging/log4net/trunk/tests/src/Util/TransformTest.cs (added)
+++ logging/log4net/trunk/tests/src/Util/TransformTest.cs Fri Sep  9 13:01:49 2011
@@ -0,0 +1,45 @@
+#region Apache License
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more 
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership. 
+// The ASF licenses this file to you under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with 
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#endregion
+
+using System;
+
+using log4net.Util;
+
+using NUnit.Framework;
+
+namespace log4net.Tests.Util {
+
+    [TestFixture]
+    public class TransformTest
+    {
+        [Test]
+        public void MaskXmlInvalidCharactersAllowsJapaneseCharacters()
+        {
+            string kome = "\u203B";
+            Assert.AreEqual(kome, Transform.MaskXmlInvalidCharacters(kome, "?"));
+        }
+
+        [Test]
+        public void MaskXmlInvalidCharactersMasks0Char() 
+        {
+            string c = "\u0000";
+            Assert.AreEqual("?", Transform.MaskXmlInvalidCharacters(c, "?"));
+        }
+    }
+}

Propchange: logging/log4net/trunk/tests/src/Util/TransformTest.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: logging/log4net/trunk/tests/src/log4net.Tests.vs2003.csproj
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/log4net.Tests.vs2003.csproj?rev=1167144&r1=1167143&r2=1167144&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/log4net.Tests.vs2003.csproj (original)
+++ logging/log4net/trunk/tests/src/log4net.Tests.vs2003.csproj Fri Sep  9 13:01:49 2011
@@ -271,6 +271,11 @@
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "Util\TransformTest.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>

Modified: logging/log4net/trunk/tests/src/log4net.Tests.vs2008.csproj
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/log4net.Tests.vs2008.csproj?rev=1167144&r1=1167143&r2=1167144&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/log4net.Tests.vs2008.csproj (original)
+++ logging/log4net/trunk/tests/src/log4net.Tests.vs2008.csproj Fri Sep  9 13:01:49 2011
@@ -191,6 +191,9 @@
     <Compile Include="Util\SystemInfoTest.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Util\TransformTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\src\log4net.vs2008.csproj">

Modified: logging/log4net/trunk/tests/src/log4net.Tests.vs2010.csproj
URL: http://svn.apache.org/viewvc/logging/log4net/trunk/tests/src/log4net.Tests.vs2010.csproj?rev=1167144&r1=1167143&r2=1167144&view=diff
==============================================================================
--- logging/log4net/trunk/tests/src/log4net.Tests.vs2010.csproj (original)
+++ logging/log4net/trunk/tests/src/log4net.Tests.vs2010.csproj Fri Sep  9 13:01:49 2011
@@ -208,6 +208,7 @@
     <Compile Include="Util\SystemInfoTest.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Util\TransformTest.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\src\log4net.vs2008.csproj">