echo é é As you can see, the program outputting é leads to Ú , but with t...">

Cmd character set

C:\Users\Kolink>php -r "echo 'é';" Ú C:\Users\Kolink>echo é é 

As you can see, the program outputting é leads to Ú , but with the echo command it echo out the desired character.

And can I customize PHP (maybe some command at the beginning of the script) to output the correct character?

+6
source share
1 answer

CMD.exe works in different code files than PHP. By the way, this is also a different code page than the standard Windows code page. This is for compatibility with older MS-DOS programs. In my country, Windows uses Windows-1250, and cmd.exe uses DOS Latin2. I believe that in the UK it will be Windows-1252 and DOS Latin1 respectively.

To get the same results, you need to use the same code page in PHP and in cmd.exe. Check which codepage is used by PHP and install cmd.exe on the same codepage. To do this, use the following command: mode con sp select=<codepagenumber> or chcp <codepagenumber> . This will change the code page only for the current instance of cmd.exe.

Here is a short list of some typical code pages and their numbers:

 DOS Latin1 850 DOS Latin2 852 Windows-1250 1250 Windows-1252 1252 UTF-8 65001 ISO-8859-1 28591 ISO-8859-2 28592 

As @Christophe Weis noted in the comments, you can search for the identifiers of other code pages on the code page page page .

+3
source

Source: https://habr.com/ru/post/898126/