From fc323759f84afa467e0f34d88e57e40cd23dc9ac Mon Sep 17 00:00:00 2001 From: YaFou <33806646+YaFou@users.noreply.github.com> Date: Wed, 1 Jul 2020 09:43:16 +0200 Subject: [PATCH] [Console] Fixes question input encoding on Windows --- Helper/QuestionHelper.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index 80f6048b8..ee6d4b664 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -158,6 +158,11 @@ private function doAsk(OutputInterface $output, Question $question) $inputStream = $this->inputStream ?: STDIN; $autocomplete = $question->getAutocompleterValues(); + if (\function_exists('sapi_windows_cp_set')) { + // Codepage used by cmd.exe on Windows to allow special characters (éàüñ). + sapi_windows_cp_set(1252); + } + if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) { $ret = false; if ($question->isHidden()) {