A
A
Andrew2016-05-23 00:55:02
css
Andrew, 2016-05-23 00:55:02

How to set encoding in server headers for css files?

I go to the /style.css page with a browser and see that all comments in Russian look like this
SNnsII3.png
. Every time I have to go into the browser settings and change the page encoding manually to utf-8, which is annoying.
In response headers I see
i6ov6at.png
Actually, how to force the server to write text/css in Content-Type ; charset=UTF-8 ?
Do I understand correctly that NGINX should do this? If so, how do you get him to do it? Or is it done somewhere else?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
Henry, 2016-05-23
@Henryh

Yes, sometimes you need to specify the encoding on the server and inside the html. But most often it happens that the css file itself, when saved in the editor, was saved in cp1251.

Z
zooks, 2016-05-23
@zooks

Add to the beginning of the file:
@charset "UTF-8";

S
Seva Sargsyan, 2016-05-23
@sevasargsyan

<link rel="stylesheet" charset="utf-8" href="ie.css">

?

L
Lynn "Coffee Man", 2016-05-23
@Lynn

nginx.org/r/charset

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question