I can not configure the correct encoding. Here is my code:

<?php header('Content-type: text/html; charset="utf-8"'); setlocale(LC_ALL, 'Russian'); $month = strftime("%B"); ?> <!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <?php echo $month; ?> </body> </html>') 

I use openserver. When I write setlocale(LC_ALL, 'Russian'); instead of the month, symbols of black rhombuses with questions are issued, any other language is issued normally. What's the matter? (I suspect the server, but don `t know what to change there.)

    4 answers 4

    Pay attention to the encoding of the file itself, which contains Russian text. Must be UTF-8 w / o BOM .

      Interestingly, in the question of Russian in white it is written that the problem with the function strftime ().

      And if you google a little bit, then you will find the answer , which explains that under Windows the correct behavior of this function with utf-8 encoding is impossible to achieve.

      That is, under the Nix, everything should work (when installing the appropriate locales, of course). For example, for a standard installation, I would write

       setlocale(LC_ALL, 'ru_RU.UTF-8'); 
         setlocale(LC_ALL, 'Russian'); 

        It is probably worth removing. And the file with the code to save in UTF8.

          Write at the beginning of the file:

           <?php header('Content-type: text/html; charset=utf-8'); 
          • Well, everything is spelled out, the problem is with the Russian language, all other selected languages ​​in local work, and in Russian for some reason not ... - AlexRFID