Skip to content

SymfonyQuestionHelper wrong output for utf8 #33928

@proggga

Description

@proggga

Symfony version(s) affected: 3.4

Description
Problem with stdout in class SymfonyQuestionHelper with multichoice

How to reproduce

<?php
require_once 'vendor/autoload.php';
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;

use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Question\ChoiceQuestion;

$in = new ArgvInput();
$out = new ConsoleOutput();
$dialog = new SymfonyQuestionHelper();

$heroes = ['Русский' => 'russian', 'żółw' => 'bar', 'super' => 'Superman'];
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 'super');
$question->setMultiselect(true);
$res = $dialog->ask($in, $out, $question);

And output

> php test.php
What is your favorite superhero? [Superman]:
  [Русский] russian
  [żółw       ] bar
  [super         ] Superman
 > super

But should be (Look at right brackets)

> php test.php
What is your favorite superhero? [Superman]:
  [Русский] russian
  [żółw   ] bar
  [super  ] Superman             
 > super

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions