Property Encoding
Encoding
Gets or sets the encoding to decode with. Null (the default) detects it: a byte-order mark first, then UTF-8 if the bytes are valid UTF-8, then the documented fallback.
public Encoding? Encoding { get; set; }
Property Value
Remarks
The fallback is Latin-1, and it is a fallback rather than an answer. windows-1252
would be the better guess for text produced on Windows, but Phase 20b measured that
.NET Core has no windows-1252 unless the host registers
CodePagesEncodingProvider — so choosing it would make the same file decode
differently on net48 and net10, and a conversion library whose output depends on the
target framework is not deterministic. Latin-1 is present everywhere and never throws.
The two differ exactly in 0x80–0x9F; a file that lives there should say so
through this property.