Add UTF-8 byte order mark (BOM) to a file if not already present.

Namespace:  FirmaSAT
Assembly:  diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531

Syntax

C#
public static int FixBom(
	string outputFile,
	string inputFile
)
Visual Basic (Declaration)
Public Shared Function FixBom ( _
	outputFile As String, _
	inputFile As String _
) As Integer

Parameters

outputFile
Type: System..::.String
Name of output file to be created with BOM.
inputFile
Type: System..::.String
Name of input file.

Return Value

Zero (0) on success or a negative error code.

Remarks

It is an error if the input file contains invalid UTF-8 characters.

Examples

CopyC#
int n = Sat.FixBom("cfdv40_new-signed-with-BOM.xml", "cfdv40-signed-nobom.xml");
Console.WriteLine("Sat.FixBom returns {0}", n);
// Read in new file as bytes, truncate, and display first 3 bytes: expecting EF-BB-BF
byte[] b = File.ReadAllBytes("cfdv40_new-signed-with-BOM.xml");
Array.Resize(ref b, 3);
Console.WriteLine(BitConverter.ToString(b));
// EF-BB-BF

See Also