Commit 27f1135e authored by Marcin Kolny's avatar Marcin Kolny Committed by Andrés G. Aragoneses

Migo: Fixed parsing RSSs with BOM (bgo#727432)

XmlDocument class cannot load an XML string starting with
the ByteOrderMark characters, so we should remove it before
serving it to consumers of AsyncWebClient class.
Signed-off-by: 's avatarAndrés G. Aragoneses <knocte@gmail.com>
parent 1f13f5e9
......@@ -735,12 +735,19 @@ namespace Migo.Net
Match match = encoding_regexp.Match (s);
if (match.Success && match.Groups.Count > 0) {
string encodingStr = match.Groups[1].Value;
Encoding enc = Encoding;
try {
Encoding enc = Encoding.GetEncoding (encodingStr);
enc = Encoding.GetEncoding (encodingStr);
if (!enc.Equals (Encoding)) {
s = enc.GetString (resultPtr);
}
} catch (ArgumentException) {}
string bom = enc.GetString (enc.GetPreamble ());
if (s.StartsWith (bom)) {
s = s.Remove (0, bom.Length);
}
}
}
} catch (Exception ex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment