Edit report at http://bugs.php.net/bug.php?id=54569&edit=1
ID: 54569
User updated by: vmiszczak at ankama dot com
Reported by: vmiszczak at ankama dot com
Summary: echo,proc_open,... issues with UTF-8 terminal
Status: Bogus
Type: Bug
Package: *General Issues
Operating System: Windows
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
"Windows has no idea about UTF-8"
Are you serious?!!
C function WideCharToMultiByte(CP_UTF8,NULL,native,-
1,encoded,sizeof(encoded),NULL,NULL) does encode as UTF-8.
printf("%s",encoded) does output correct things within a rightly
configured
terminal, just like you do under Linux.
PHP does not.
Previous Comments:
------------------------------------------------------------------------
[2011-04-19 18:10:50] [email protected]
Windows has no idea about UTF-8, especially not in console mode. But
that does not
mean the data you are echo'ing is not correct UTF-8.
------------------------------------------------------------------------
[2011-04-19 17:56:04] vmiszczak at ankama dot com
Description:
------------
Those functions (at least) do strange things when using an UTF-8
terminal under
Windows.
For instance, doing a php 'echo' on a UTF-8 string does not output the
string!
Printing the same string with fwrite(STDOUT,$string) works.
More problematic : parsing UTF-8 data and trying to execute a program
(I've tried
popen,exec,proc_open,passthru) with those data as program arguments make
the
program to not understand the decoding that should be used.
Writing the script output to a batch file and executing the batch works.
Test script:
---------------
Launch a cmd.exe.
Execute chcp 65001 to get the terminal use UTF-8 (make sure your font
support this, use Lucida console for instance).
Launch this script :
<?php
$data="ï";
fwrite(STDOUT,$data."\n");
echo $data."\n";
?>
Expected result:
----------------
I'm expecting UTF-8 data to be shown correctly and program execution
string passed
to exec() and so use correct string decoding.
Actual result:
--------------
ï
��
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54569&edit=1