The latest Denver local web server is installed, there is a php file in which the utf-8 encoding is specified, the format of this utf-8 file without BOM, and on the output text is displayed in cp1251 encoding. What to do?

result

  • He probably in the settings of Apache by default spelled out 1251 and she interrupts the encoding specified in the file .... you need to see the defaultcharset change. Suddenly it will help ......... and I also advise you to kill Denver and go at least to an openserver .... Denver has long died already and nove does not support ..... mysql long ago 5.7. there is ... php 7 and apache 2.4 ..... and in the Denver there is no ...... - Alexey Shimansky
  • one
    Does anyone else use this junk? I'm talking about Denver. - Visman
  • Denver hasn't been updated for several years already and the ancient PHP version is included in the package, so you better change to something more modern, like OpenServer. Rest in peace, Denwer, smart you were a development environment. - AK

1 answer 1

The problem lies in the fact that in the configuration file of the Denver Apache-server, Windows-1251 flaunts as the default encoding, for this reason, instructions for using this particular encoding to read the websites being opened are forcibly transmitted to browsers. Very often, this instruction is perceived as fundamental, and the browser does not pay attention to what you transmit using a meta tag.

httpd.conf is responsible for global instructions for the server, i.e. Changes made to it will affect all sites that we will have stored on the server. We need to edit it: look for “AddDefaultCharset windows-1251 ″ and change it to“ AddDefaultCharset utf-8 ″.

Restart the server and everything should be fine :)

  • that's right, thanks for the help, in a couple of minutes you will get the best answer - perfect