Skip to content

Latest commit

 

History

History
49 lines (41 loc) · 1.57 KB

encoding.md

File metadata and controls

49 lines (41 loc) · 1.57 KB

Encoding

UseUtf8NoBom

The default encoding for snapshot files uses UTF-8 with byte order marks (BOM) enable. To disable UTF-8 BOMs, call VerifierSettings.UseUtf8NoBom.

public static class ModuleInitializer
{
    [ModuleInitializer]
    public static void Init() =>
        VerifierSettings.UseUtf8NoBom();
}

snippet source | anchor

UseEncoding

To override the encoding used for snapshot files, replacing the default UTF-8 encoding, call VerifierSettings.UseEncoding providing a System.Text.Encoding instance.

public static class ModuleInitializer
{
    [ModuleInitializer]
    public static void Init()
    {
        var encoding = new UnicodeEncoding(
            bigEndian: false,
            byteOrderMark: true,
            throwOnInvalidBytes: true);
        VerifierSettings.UseEncoding(encoding);
    }
}

snippet source | anchor