-
-
Notifications
You must be signed in to change notification settings - Fork 177
Open
Description
When using the Save function like:
InvoiceDescriptor descriptor = InvoiceDescriptor.CreateInvoice(......);
descriptior.AddNote("Abrechnung für ...");
descriptor.Save("zugferd.xml", ...);
the written xml will have a content with misspelled umlauts even though the encoding states "UTF-8".:
<ram:Content>Abrechnung für ...</ram:Content>
This happens when using .NET 8. The error does not happen when using the .NET framework (I've tried 4.7.2).
As a workaround for .NET 8 I found the following:
using (MemoryStream ms = new MemoryStream())
{
descriptor.Save(ms, ZUGFeRDVersion.Version23, Profile.Comfort, ZUGFeRDFormats.CII);
ms.Position = 0;
string xmlContent;
using (StreamReader reader = new StreamReader(ms, Encoding.UTF8))
{
xmlContent = reader.ReadToEnd();
}
var utf8WithBom = new UTF8Encoding(true); // BOM einschließen
File.WriteAllText("zugferd-invoice.xml", xmlContent, utf8WithBom);
}
Metadata
Metadata
Assignees
Labels
No labels