Bug #69333 [Opn->Csd]: UTF8 output to console window is ... interesting!

From: Date: Mon, 08 Aug 2016 09:51:27 +0000
Subject: Bug #69333 [Opn->Csd]: UTF8 output to console window is ... interesting!
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203062@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 Updated by: ab@php.net Reported by: RQuadling at GMail dot com Summary: UTF8 output to console window is ... interesting! -Status: Open +Status: Closed Type: Bug Package: CGI/CLI related Operating System: Windows PHP Version: 5.4.39 -Assigned To: +Assigned To: ab Block user comment: N Private report: N New Comment: Fixed in PHP 7.1 Thanks. Previous Comments: ------------------------------------------------------------------------ [2015-03-30 13:38:17] RQuadling at GMail dot com More updates. And added a pipe through cywgin's hexdump to see what comes out of PHP. Seems the captured output is fine, but uncaptured, ... seems PHP is behaving differently in some way. ------------------------------------------------------------------------ [2015-03-30 13:21:07] RQuadling at GMail dot com 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#203062) next »