mirror of
https://github.com/ckaczor/FeedCenter.git
synced 2026-02-16 10:58:31 -05:00
Clean up unescaped & in feed XML
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user