Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

QuestionHelper with AutoComplete mangles multi byte characters on output #29966

Copy link
Copy link
Closed
@edhgoose

Description

@edhgoose
Issue body actions

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 é).

1__root_ip-10-38-167-243____docker_

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConsoleGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.Status: Needs Review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.