Skip to content

Commit

Permalink
use UTF8Encoding without BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
tipa committed Oct 30, 2024
1 parent 6886851 commit d1245a9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 15 deletions.
4 changes: 1 addition & 3 deletions ZUGFeRD/InvoiceDescriptor1Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;


namespace s2industries.ZUGFeRD
{
Expand Down Expand Up @@ -61,7 +59,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
long streamPosition = stream.Position;

this.Descriptor = descriptor;
this.Writer = new ProfileAwareXmlTextWriter(stream, Encoding.UTF8, descriptor.Profile);
this.Writer = new ProfileAwareXmlTextWriter(stream, descriptor.Profile);
this.Writer.SetNamespaces(new Dictionary<string, string>()
{
{ "xsi", "http://www.w3.org/2001/XMLSchema-instance" },
Expand Down
6 changes: 1 addition & 5 deletions ZUGFeRD/InvoiceDescriptor20Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@
*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Xml;


namespace s2industries.ZUGFeRD
{
Expand Down Expand Up @@ -57,7 +53,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
long streamPosition = stream.Position;

this.Descriptor = descriptor;
this.Writer = new ProfileAwareXmlTextWriter(stream, Encoding.UTF8, descriptor.Profile);
this.Writer = new ProfileAwareXmlTextWriter(stream, descriptor.Profile);
this.Writer.SetNamespaces(new Dictionary<string, string>()
{
{ "a", "urn:un:unece:uncefact:data:standard:QualifiedDataType:100" },
Expand Down
3 changes: 1 addition & 2 deletions ZUGFeRD/InvoiceDescriptor22UBLWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace s2industries.ZUGFeRD
{
Expand All @@ -44,7 +43,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
long streamPosition = stream.Position;

this.Descriptor = descriptor;
this.Writer = new ProfileAwareXmlTextWriter(stream, Encoding.UTF8, descriptor.Profile);
this.Writer = new ProfileAwareXmlTextWriter(stream, descriptor.Profile);
Dictionary<string, string> _namespaces = new Dictionary<string, string>()
{
{ "cac", "urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" },
Expand Down
4 changes: 1 addition & 3 deletions ZUGFeRD/InvoiceDescriptor23CIIWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.IO;
using System.Linq;
using System.Text;
using System.Xml;


namespace s2industries.ZUGFeRD
{
Expand Down Expand Up @@ -52,7 +50,7 @@ public override void Save(InvoiceDescriptor descriptor, Stream stream, ZUGFeRDFo
long streamPosition = stream.Position;

this.Descriptor = descriptor;
this.Writer = new ProfileAwareXmlTextWriter(stream, Encoding.UTF8, descriptor.Profile);
this.Writer = new ProfileAwareXmlTextWriter(stream, descriptor.Profile);
this.Writer.SetNamespaces(new Dictionary<string, string>()
{
{ "a", "urn:un:unece:uncefact:data:standard:QualifiedDataType:100" },
Expand Down
4 changes: 2 additions & 2 deletions ZUGFeRD/ProfileAwareXmlTextWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public ProfileAwareXmlTextWriter(string filename, System.Text.Encoding encoding,
}


public ProfileAwareXmlTextWriter(System.IO.Stream w, System.Text.Encoding encoding, Profile profile)
public ProfileAwareXmlTextWriter(System.IO.Stream w, Profile profile)
{
this.TextWriter = XmlWriter.Create(w, new XmlWriterSettings()
{
Encoding = encoding,
Encoding = new UTF8Encoding(false),
Indent = true
});
this.CurrentProfile = profile;
Expand Down

0 comments on commit d1245a9

Please sign in to comment.