From 42d4222fb3dfd324614ba745cf65c482e6126f47 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Tue, 26 May 2026 11:24:54 +0200 Subject: [PATCH] Handle UTF-8 BOM in string conversion Previously, the method directly converted a byte array to a string without accounting for a potential UTF-8 Byte Order Mark (BOM). This commit introduces logic to remove the BOM (if present) using `TrimStart('\uFEFF')` after converting the byte array to a string. Additionally, a comment was added to clarify the purpose of this change. --- DXApp.TemplateKitProject/Services/ZugferdExtractorService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DXApp.TemplateKitProject/Services/ZugferdExtractorService.cs b/DXApp.TemplateKitProject/Services/ZugferdExtractorService.cs index a66f9e9..bd2fafb 100644 --- a/DXApp.TemplateKitProject/Services/ZugferdExtractorService.cs +++ b/DXApp.TemplateKitProject/Services/ZugferdExtractorService.cs @@ -25,7 +25,9 @@ if (isZugferd || attachment.MimeType == "text/xml") { byte[] data = attachment.Data; - return Encoding.UTF8.GetString(data); + // BOM entfernen falls vorhanden (EF BB BF am Anfang) + var text = Encoding.UTF8.GetString(data); + return text.TrimStart('\uFEFF'); } }