Why the response doesn't contain Content-Encoding header?
using System.Net;
using System.Text;
namespace MyServer
{
    class Program
    {
        static void Main(string[] args)
        {
           var listener = new HttpListener();
           listener.Prefixes.Add("http://localhost:8001/");
           listener.Start();
           var context = listener.GetContext();
           var response = context.Response;
           response.ContentEncoding = Encoding.UTF8;
           response.ContentType = "application/json";
           var json = "{'message':'Привет, мир!'}";
           var jsonBytes = response.ContentEncoding.GetBytes(json);
           response.ContentLength64 = jsonBytes.LongLength;
           response.StatusCode = (int)HttpStatusCode.OK;
           response.OutputStream.Write(jsonBytes,0,jsonBytes.Length);
           response.OutputStream.Close();
        }
    }
}

 
     
    