I have this part of code
Response.Charset = _encodingcode;
Response.AddHeader("Content-Encoding", _encodingcode);
Response.HeaderEncoding = Encoding.GetEncoding(_encodingcode);
Response.ContentEncoding = Encoding.GetEncoding(_encodingcode);
Response.ContentType = mimeType;
return File(_filedata, mimeType, $"{id}{_extension}");
But always when download the file the notepad's encoding is ANSI
Notepad receives only _filedata bytes which are saved to disk as file with name specified in 3rd parameter, but neither mimeType nor any element of response header or body, that why specifying encoding has no effect.
You can give a hint to Notepad about some encodings by adding Byte Order Mark (BOM) at the beginning of you bytes stream:
Apart from that, there is no way to tell Notepad what encoding it should use.