Table of Contents

Property Encoding

Namespace
YndigoBlue.Velocity.Model
Assembly
YndigoBlue.Velocity.dll

Encoding

Gets or sets the encoding the data file is read as. Defaults to null, which reads it as UTF-8.

public Encoding Encoding { get; set; }

Property Value

Encoding

Remarks

Set this for a file written in something else, such as a single byte code page, where every byte above 127 would otherwise be read as a character that cannot be decoded and replaced. Nothing in the file announces that, so an import of one reports no error and loads the wrong text.

A byte order mark still wins wherever the file carries one, whether or not this is set, since a file that declares its own encoding is describing itself and the mark is not part of the data. Code pages beyond the ones built in need Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) before GetEncoding(int) will return them.