Clean up unescaped & in feed XML

This commit is contained in:
2014-09-16 09:43:32 -04:00
parent 7d5f6b2779
commit ef61ce278c
2 changed files with 15 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
using Common.Debug;
using System.Text.RegularExpressions;
using Common.Debug;
using Common.Xml;
using FeedCenter.FeedParsers;
using System;
@@ -172,6 +173,10 @@ namespace FeedCenter
// Clean up common invalid XML characters
feedText = feedText.Replace(" ", " ");
// Find ampersands that aren't properly escaped and replace them with escaped versions
var r = new Regex("&(?!(?:[a-z]+|#[0-9]+|#x[0-9a-f]+);)");
feedText = r.Replace(feedText, "&");
return Tuple.Create(FeedReadResult.Success, feedText);
}
catch (IOException ioException)