Skip to content

Commit

Permalink
Fixed issue with encoding/parsing of resx xml
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewButenko committed Jul 17, 2019
1 parent 882b073 commit 0083c94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions AB.HtmlLocalization.Plugins/GetLocalizations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,19 @@ public void Execute(IServiceProvider serviceProvider)
var content = t.GetAttributeValue<string>("content");
content = Encoding.Default.GetString(Convert.FromBase64String(content));
var contentDocument = XDocument.Parse(content);
content = Encoding.UTF8.GetString(Convert.FromBase64String(content));
XDocument contentDocument;
try
{
contentDocument = XDocument.Parse(content);
}
catch
{
content = content.Substring(1);
contentDocument = XDocument.Parse(content);
}
var dataNodes = contentDocument.XPathSelectElements("root/data").Select(n => new { Name = n.Attribute("name").Value, Value = n.Element("value").Value }).ToDictionary(n => n.Name, n => n.Value);
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 0083c94

Please sign in to comment.