Skip to content

Commit

Permalink
Merge branch 'RemoveBom' of https://github.com/ahsonkhan/ReportGenerator
Browse files Browse the repository at this point in the history
 into develop
  • Loading branch information
danielpalme committed Sep 3, 2020
2 parents 3e49288 + 8cea3a1 commit b769d48
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ CHANGELOG
4.6.6.0

* New: #379: Added setting to allow saving report types to different directories
* New: #380: Removed UTF-8 BOM from all generated XML files

4.6.5.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Common;
using Palmmedia.ReportGenerator.Core.Logging;
Expand Down Expand Up @@ -407,7 +409,16 @@ public void CreateSummaryReport(SummaryResult summaryResult)

Logger.InfoFormat(Resources.WritingReportFile, targetPath);

result.Save(targetPath);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(targetPath, settings))
{
result.Save(writer);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Common;
using Palmmedia.ReportGenerator.Core.Logging;
Expand Down Expand Up @@ -254,7 +256,16 @@ public void CreateSummaryReport(SummaryResult summaryResult)

Logger.InfoFormat(Resources.WritingReportFile, targetPath);

result.Save(targetPath);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(targetPath, settings))
{
result.Save(writer);
}
}

/// <summary>
Expand Down
13 changes: 12 additions & 1 deletion src/ReportGenerator.Core/Reporting/Builders/SonarQubeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Common;
using Palmmedia.ReportGenerator.Core.Logging;
Expand Down Expand Up @@ -112,7 +114,16 @@ public void CreateSummaryReport(SummaryResult summaryResult)

Logger.InfoFormat(Resources.WritingReportFile, targetPath);

this.document.Save(targetPath);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(targetPath, settings))
{
this.document.Save(writer);
}
}

/// <summary>
Expand Down
13 changes: 12 additions & 1 deletion src/ReportGenerator.Core/Reporting/Builders/XmlReportBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Logging;
using Palmmedia.ReportGenerator.Core.Parser.Analysis;
Expand Down Expand Up @@ -149,7 +151,16 @@ public override void CreateClassReport(Class @class, IEnumerable<FileAnalysis> f

Logger.InfoFormat(Resources.WritingReportFile, targetPath);

result.Save(targetPath);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(targetPath, settings))
{
result.Save(writer);
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Common;
using Palmmedia.ReportGenerator.Core.Logging;
Expand Down Expand Up @@ -159,7 +161,16 @@ public void CreateSummaryReport(SummaryResult summaryResult)

Logger.InfoFormat(Resources.WritingReportFile, targetPath);

result.Save(targetPath);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(targetPath, settings))
{
result.Save(writer);
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using Palmmedia.ReportGenerator.Core.Common;
using Palmmedia.ReportGenerator.Core.Logging;
Expand Down Expand Up @@ -87,7 +89,17 @@ internal void CreateReport(IEnumerable<Assembly> assemblies, DateTime executionT
{
using (var stream = new MemoryStream())
{
document.Save(stream);
XmlWriterSettings settings = new XmlWriterSettings()
{
Encoding = new UTF8Encoding(false),
Indent = true
};

using (XmlWriter writer = XmlWriter.Create(stream, settings))
{
document.Save(writer);
}

stream.Position = 0;
this.historyStorage.SaveFile(stream, fileName);
}
Expand Down

0 comments on commit b769d48

Please sign in to comment.