When executing the following file from a Windows cmd, the accented characters are not displayed correctly.
The test.php file is recorded as UTF-8.
file test.php:
<?php
printf ("áéíóúÑñ");
?>
C: \ Appserv \ php \ php -f test.php
However, if I redirect the output to a file in the form
C: \ Appserv \ php \ php -f test.php > exit
When opening the output file if I see the acentos
and ñ
correctly but in the Windows console these rare characters are seen:
The Windows version is
Microsoft Windows [Version 10.0.17134.165]
The php version is
PHP 5.1.1 (cli) (built: Nov 27 2005 21:39:02)
Copyright (c) 1997-2005 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2005 Zend Technologies
with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans
I know that the php version is old but my client does not accept me changing it.
The active code page in the cmd is 850
If I add chcp 65001 immediately before the execution of C: \ Appserv \ php \ php -f test.php nothing is displayed on the screen anymore.