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:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user