I found this fix:
// Read Text test - Read the text from a txt file and add create a new txt file
// with the original txt file data
public void ReadAndWriteTextTest()
{
// Get the root path
var webRoot = _env.WebRootPath;
// Text with this txt file which is a copy of the MS Word document
// what_we_do_and_how.docm
var inputfile = System.IO.Path.Combine(webRoot, "What_we_do_and_how ENCODED.txt");
// The txt file name to be created.
var outputfile = System.IO.Path.Combine(webRoot, "A6CWrite.txt");
// RC@202503100000 - Get the 1252 specific code page to use with Encoding.RegisterProvider
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// Read the input txt file data
string inputdata = System.IO.File.ReadAllText(inputfile, System.Text.Encoding.GetEncoding(1252));
// Create and write to the ouput txt file
System.IO.File.WriteAllText(outputfile, inputdata, System.Text.Encoding.GetEncoding(1252));
}
the outputfile now shows the correct encoding :