Bug #69333 [Opn]: UTF8 output to console window is ... interesting!
| From: | RQuadling at GMail dot com | Date: | Mon, 30 Mar 2015 13:21:08 +0000 |
| Subject: | Bug #69333 [Opn]: UTF8 output to console window is ... interesting! | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191725@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69333&edit=1
ID: 69333
User updated by: RQuadling at GMail dot com
Reported by: RQuadling at GMail dot com
Summary: UTF8 output to console window is ... interesting!
Status: Open
Type: Bug
Package: CGI/CLI related
Operating System: Windows
PHP Version: 5.4.39
Block user comment: N
Private report: N
New Comment:
And bug 3:
Added var_dump() to the PHP mix.
In a PHP script, the var_dump() is WAY wrong!!! 7 characters (yay) but with an extra 'a'
at the end!
But if output capture is being performed, then the output is correct. No extra 'a' !
I've updated the gist to properly enforce utf8 mode in the console - https://gist.github.com/RQuadling/068ac672d97e2e3e6cfa
I realised that I was already in codepage 65001. This didn't affect the bugs I am reporting.
Previous Comments:
------------------------------------------------------------------------
[2015-03-30 12:56:43] RQuadling at GMail dot com
I typo-ed an extra 'echo' in my bug report ...
The php script should be ...
<?php echo 'página';
------------------------------------------------------------------------
[2015-03-30 12:54:44] RQuadling at GMail dot com
Description:
------------
Attempting to display UTF-8 content in a Windows console (having used chcp 65001 to allow UTF-8
content to be displayed)
2 issues are found.
1 - php -r does not read UTF-8 from the commandline.
php -r "echo 'página';"
fails with
p�gina
2 - echo-ing utf-8 content adds an extra line.
Running the script ...
<?php echo echo 'página';
outputs página correctly, but with an extra line on the display.
But, if you capture the output, there is no extra line, which suggests to me that PHP is calling a
function that outputs the extra line in some way.
Test script:
---------------
This is a batch file that demonstrates that UTF-8 output is possible in some circumstances.
https://gist.github.com/RQuadling/068ac672d97e2e3e6cfa
Expected result:
----------------
Lots of ...
====== [description]
página
==OK==
Actual result:
--------------
Some ...
====== [description]
página
==OK==
but also ...
====== Via php -r
p�gina
=????= **** NON UNICODE DISPLAYED ****
====== Via php -r, captured to a log file and displayed
p�gina
=????= **** NON UNICODE DISPLAYED ****
====== From a php script
página
=????= **** EXTRA LINE DISPLAYED ****
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69333&edit=1