What I need
Asp.net core app creates text files, whose encoding should match encoding of the hosting OS. This is because there is some legacy 3rd party software reading the files which can't handle UTF-8
What I have
The app is deployed to Windows Server, that is configured to use Windows-1250 charset.
I currently hardcoded it:
using var writer = new StreamWriter(fileStream, Encoding.GetEncoding("windows-1250"))
Question
How do I get host's OS's default encoding, so that I don't need to hardcode or configure it?