From 91a364c7712503ad948d13b28cf4044916995464 Mon Sep 17 00:00:00 2001 From: aleksandr-shevchenko Date: Mon, 10 Apr 2023 14:08:12 +0400 Subject: [PATCH] [Console] Restoring the ability to output unicode text to the Win10 console Restoring the ability to output unicode text to the Win10 console after corrupting the console on line 224 --- src/Symfony/Component/Console/Terminal.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Symfony/Component/Console/Terminal.php b/src/Symfony/Component/Console/Terminal.php index 08c53535b1d35..24cef534052f1 100644 --- a/src/Symfony/Component/Console/Terminal.php +++ b/src/Symfony/Component/Console/Terminal.php @@ -157,6 +157,8 @@ private static function readFromProcess(string $command): ?string 2 => ['pipe', 'w'], ]; + $cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0; + $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]); if (!\is_resource($process)) { return null; @@ -167,6 +169,10 @@ private static function readFromProcess(string $command): ?string fclose($pipes[2]); proc_close($process); + if ($cp) { + sapi_windows_cp_set($cp); + } + return $info; } }