Answer the question
In order to leave comments, you need to log in
What is CSS decoding without encoding in cp1251 Chrome?
Haven't tested it in other browsers, but the gist is that nginx is configured, by default, as utf-8.
And everything goes smoothly until it comes to CSS with Cyrillic. Type: [data-trainbrand="САПСАН"] {}
In my chrome it turns into something like (this is not my coding pair, but for clarity [data-trainbrand="‘ЂЏ‘ЂЌ"] {}
Content-Type is "text/css" and nothing else. No utf-8 or cp1251.
I don't really understand the further mechanics of the browser with this mess,
but, of course, none of those converted from utf-8 to cp1251 will
work on HTML utf-8.
I solved the problem by setting the following piece of the nginx config hard through the server directive:
location ~ \.css {
proxy_hide_header Content-Type;
add_header Content-Type "text/css; charset=UTF-8";
}
А теперь вопросы:
— Почему кусок конфига из документации, не выставляет кодировку в Content-Type
— С какого Chrome решает, что нужно декодировать документ в локальную виндовую кодировку
<code lang="nginx">
include conf/win-utf
charset utf-8;
source_charset utf-8;
</code>
Спасибо.
Answer the question
In order to leave comments, you need to log in
perhaps the file itself is saved in cp1251
In the sublime, you can change the encoding
FIle -> Save with encoding -> UTF8 with BOM
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question