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.
This commit is contained in:
OlgunR
2026-05-26 11:24:54 +02:00
parent 4c90d2e5f1
commit 42d4222fb3

View File

@@ -25,7 +25,9 @@
if (isZugferd || attachment.MimeType == "text/xml") if (isZugferd || attachment.MimeType == "text/xml")
{ {
byte[] data = attachment.Data; 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');
} }
} }