[mapguide-commits] r7073 - in trunk/Tools/Maestro: MaestroAPITests OSGeo.MapGuide.MaestroAPI
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Oct 4 05:19:43 PDT 2012
Author: jng
Date: 2012-10-04 05:19:43 -0700 (Thu, 04 Oct 2012)
New Revision: 7073
Modified:
trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
Log:
#2136: Fix FDO class name encoding/decoding. Fix an extra case that tripped up the existing implementation.
Modified: trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs 2012-10-04 07:03:10 UTC (rev 7072)
+++ trunk/Tools/Maestro/MaestroAPITests/SchemaTests.cs 2012-10-04 12:19:43 UTC (rev 7073)
@@ -413,6 +413,11 @@
Assert.AreEqual( name2, "_x2d-_x2f-Class" );
Assert.AreEqual( name1, Utility.DecodeFDOName(name2) );
+ name1 = "Foo/Bar - snafu";
+ name2 = Utility.EncodeFDOName(name1);
+ Assert.AreEqual(name2, "Foo-x2f-Bar-x20---x20-snafu");
+ Assert.AreEqual(name1, Utility.DecodeFDOName(name2));
+
// Backward compatibility check. Make sure old-style 1st character encodings get decoded.
name2 = "-x40-A";
Assert.AreEqual( Utility.DecodeFDOName(name2), "@A" );
Modified: trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs
===================================================================
--- trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2012-10-04 07:03:10 UTC (rev 7072)
+++ trunk/Tools/Maestro/OSGeo.MapGuide.MaestroAPI/Utility.cs 2012-10-04 12:19:43 UTC (rev 7073)
@@ -668,7 +668,7 @@
outName.Append("-");
}
}
- outName.Append(bMatchedToken ? token : ReplaceBadChars(token));
+ outName.Append(bMatchedToken ? token : ReplaceBadChars(token, outName.Length == 0));
}
@@ -701,16 +701,16 @@
return result;
}
- private static string ReplaceBadChars(string token)
+ private static string ReplaceBadChars(string token, bool bFirstInString)
{
StringBuilder sb = new StringBuilder();
- bool bFirstChar = true;
+ bool bFirstChar = bFirstInString;
foreach (char c in token)
{
if (Char.IsDigit(c) || IsValidXmlChar(c))
sb.Append(c);
else
- sb.AppendFormat("{0}x{1:X}-", bFirstChar ? "_" : "-", Convert.ToInt32(c));
+ sb.Append(string.Format("{0}x{1:X}-", bFirstChar ? "_" : "-", Convert.ToInt32(c)).ToLower());
bFirstChar = false;
}
More information about the mapguide-commits
mailing list