[Console] Fixes question input encoding on Windows

This commit is contained in:
YaFou 2020-07-01 09:43:16 +02:00
parent 91f30e0b62
commit 4288df4f74
No known key found for this signature in database
GPG Key ID: A112DE339CED408A
1 changed files with 5 additions and 0 deletions

View File

@ -158,6 +158,11 @@ class QuestionHelper extends Helper
$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()) {