V
V
veryoriginalnickname2021-10-10 18:16:32
Nginx
veryoriginalnickname, 2021-10-10 18:16:32

Krakozyabry when distributing txt?

If you follow the url to txt, then in the browser it gives krakozyabry. If you save on the PC, then there is no krakozyabr.
Added to the http block
charset utf-8;
does not help.
Config, nginx and PC restarted, does not help either. How to fix?
nginx 1.21.3 (windows)

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
  charset utf-8;
  server_tokens off;
  ssl_certificate     chtoto/cert.pem;
  ssl_certificate_key chtoto/key.pem;
  ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers         HIGH:!aNULL:!MD5;
  ssl_session_cache   shared:SSL:10m;
    ssl_session_timeout 10m;
  keepalive_timeout   70;
  
  server {
    listen 80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
  }
  
  server {
    listen 443 ssl;
    server_name static.example.com;
    location /uploads {
        sendfile           on;
      sendfile_max_chunk 1m;
      root gdeto;
    }
  }
}

response headers:
HTTP/1.1 304 Not Modified
Server: nginx
Date: Sun, 10 Oct 2021 15:22:58 GMT
Last-Modified: Sun, 10 Oct 2021 14:56:08 GMT
Connection: keep-alive
ETag: "6162ff08-c"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rPman, 2021-10-10
@veryoriginalnickname

content of the text in what encoding then?
the web server does not touch text files.
the browser must look at the request headers if it is a text file, and prefer the meta charset tag if it is html, but when the file is opened locally, the encoding is determined automatically by the content (statistical analysis).
There is also a moment, the browser can remember the last encoding that you chose (for the site or globally not sure here), i.e. when you chose a non-utf encoding, now he shows it to you, just select Automatic in the browser menu

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question