Bug #80062 [Opn->Csd]: STDIN not support Chinese in CLI mode

From: Date: Sat, 05 Sep 2020 06:51:50 +0000
Subject: Bug #80062 [Opn->Csd]: STDIN not support Chinese in CLI mode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228893@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80062&edit=1 ID: 80062 User updated by: tsxgt at 163 dot com Reported by: tsxgt at 163 dot com Summary: STDIN not support Chinese in CLI mode -Status: Open +Status: Closed Type: Bug Package: Streams related Operating System: Windows PHP Version: 7.4.10 Block user comment: N Private report: N New Comment: solved: sapi_windows_cp_set(936); Previous Comments: ------------------------------------------------------------------------ [2020-09-05 05:27:54] tsxgt at 163 dot com Description: ------------ Windows system, run a php file with chinese character in PHP CLI mode, it return s unexpected value PHP 5.6.40 is ok PHP 7.0.33 is ok PHP >= 7.1.33 is bad Test script: --------------- <?php while (1) { $s = fgets(STDIN); echo var_dump($s); echo bin2hex($s); echo "\r\n"; } Expected result: ---------------- aaa string(5) "aaa " 6161610d0a 你好 string(6) "你好 " c4e3bac30d0a Actual result: -------------- aaa string(5) "aaa " 6161610d0a 你好 string(4) "\000\000 " 00000d0a ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80062&edit=1

« previous php.bugs (#228893) next »