Description
Symfony version(s) affected: master
Description
We're using the QuestionHelper to read input. The Helper has an Auto Complete, and some of what we're inputting is multibyte characters like é
.
When we do this, é
becomes: ��
on the command line. (In the screenshot below, I included a d
after the é
).
I understand this to be because of the use of fread
: https://github.com/symfony/console/blob/master/Helper/QuestionHelper.php#L214.
The actual recorded value is correct, but the content put on the command line is not.
Removing the auto complete resolves the problem, but obviously then removes the auto complete functionality.
How to reproduce
I believe this is a minimal test case:
class QuestionAsker extends Command
{
protected function configure()
{
$this->setName("app:question-asker");
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$question = new Question('Enter something multi byte:');
$question->setAutocompleterValues(
["a", "b", "c"]
);
// Write out the current content so it's easier to edit
//$output->write($currentContent);
$data = $helper->ask($input, $output, $question);
$output->writeln("This is incorrect ^");
$output->writeln("This data is correct:");
$output->writeln($data);
}
}
Possible Solution
I'm not sure 😞
Additional context
We did this on a Mac, running either Terminal or ITerm2 (same output in both cases).