BOM size for different encodings
The number of bytes for the Byte Order Mark („BOM“) differs among the used encodings. public static bool IsBomRelevantEncoding( Encoding encoding, out int bomSizeBytes ) { if ( encoding == Encoding.Unicode ) { bomSizeBytes = 2; return true; } else if (…