A website created in Windows 1251 (Cyrillic) encoding is displayed in Google Chrome and Opera browsers in Windows 1252 (Western) encoding. On the screen instead of gibberish text. Manually on Chrome it is easily eliminated through the browser settings (settings - in addition - the encoding). But the automatic detection of encoding by the browser does not work. Internet Explorer and Mozilla Firefox display everything fine. How to solve the problem with browsers Chrome and Opera.

  • 7
    utf-8 yuzay, cp-1251 is outdated long ago - Naumov
  • There are also cases when you need to set the server to send the encoding, it is indicated in .htacces. - Vlad
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

In order to tell the browser in what encoding to display the page, it needs to specify the HTML header inside the <head></head>

 <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> 

or send from php

 <?php header("Content-Type: text/html; charset=windows-1251"); ?> 

(but it is better to use utf-8, as recommended in the comments)