1

Closed

RemoveInvalidXmlHexadecimalCharactersTest returns empty string

description

even just in this simple case safeXml is "";
 
string safeXml = SyndicationEncodingUtility.RemoveInvalidXmlHexadecimalCharacters("123");
 
I discovered it when i tried to load feed from string and this method returned just cryptic string of slashes.
 
I've added test case
 
[TestMethod]
public void RemoveInvalidXmlHexadecimalCharactersTest()
{
  string safeXml = SyndicationEncodingUtility.RemoveInvalidXmlHexadecimalCharacters("123");
 
  Assert.AreEqual("123", safeXml); // safeXml is empty
}
 
I've fixed it by changing regular expression from [\x01-\x08\x0B-\x0C\x0E-\x1F\xD800-\xDFFF\xFFFE-\xFFFF] to [^\u0009\u000A\u000D\u0020-\uD7FF\uE000-\uFFFD].
 
I left .net 2.0 version untouched in case I'll discover nay error in near future. If all will work fine I'll change 2.0 version too.
Closed Dec 26, 2009 at 7:41 PM by Trickster
fixed (only in 3.5 branch)

comments

styx31 wrote Jan 26, 2010 at 2:07 PM

The Test case is missing from server repository. The CSPROJ references it but the file is missing.