Thanks to visit codestin.com
Credit goes to github.com

Skip to content

On windows MINGW32 git bash or cmd.exe call QuestionHelper ask method input chinese word in my command bug #31870

Closed
@lcp0578

Description

@lcp0578

Symfony version(s) affected: 3.4.28

Description

my command code:

// table comment
        $question = new Question($questionHelper->getQuestion('Enter table comment', ''), '');
        $tableComment = $questionHelper->ask($input, $output, $question);

on windows MINGW32.

php bin/console kit:doctrine:generate:entity -vvv

Welcome to the kitlabs Doctrine2 entity generator

This command helps you generate Doctrine2 entities.

First, you need to give the entity name you want to generate.
You must use the shortcut notation like AcmeBlogBundle:Post.

The Entity shortcut name: ProcessBundle:Test
P[K7rocessBundle8r[K7ocessBundle8o[K7cessBundle8c[K7essBundle8e[K7ssBundle8s[K7sBundle8s[K7Bundle8B[K7undle8u[K7ndle8n[K7dle8d[K7le8l[K7e
8e[K78:[KT[Ke[Ks[Kt[K
Enter table comment: 测试

In QuestionHelper.php line 175:

[Symfony\Component\Console\Exception\RuntimeException]
Aborted.

Exception trace:
() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:175
Symfony\Component\Console\Helper\QuestionHelper->doAsk() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:80

Symfony\Component\Console\Helper\QuestionHelper->ask() at D:\phpStudy\WWW\space2019\law\vendor\kitlabs\kit-generator-bundle\Command\GenerateDoctrineEntityCommand.php:167
Kit\GeneratorBundle\Command\GenerateDoctrineEntityCommand->interact() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Command\Command
.php:240
Symfony\Component\Console\Command\Command->run() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:987
Symfony\Component\Console\Application->doRunCommand() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:86

Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:25
5
Symfony\Component\Console\Application->doRun() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:74
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at D:\phpStudy\WWW\space2019\law\vendor\symfony\symfony\src\Symfony\Component\Console\Application.php:148
Symfony\Component\Console\Application->run() at D:\phpStudy\WWW\space2019\law\bin\console:27

kit:doctrine:generate:entity [--entity [ENTITY]] [--table_comment [TABLE_COMMENT]] [--fields FIELDS] [--format FORMAT] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--
version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] []

the code: \vendor\symfony\symfony\src\Symfony\Component\Console\Helper\QuestionHelper.php:175

 if (false === $ret) {
               $ret = fgets($inputStream, 4096);
               if (false === $ret) {
                   throw new RuntimeException('Aborted.');
               }
               $ret = trim($ret);
           }

but, when i use cmd.exe i can't input chinese word.
on my macbook it it ok.
my extends bundle github.com/kitlabs-cn/KitGeneratorBundle
How to reproduce

install my extends bundle
composer require kitlabs/kit-generator-bundle
run my command(on MINGW32 git bash):
php bin/console kit:doctrine:generate:entity -vvv
when "Enter table comment: " input "测试" or "你好" (chines word) it is Aborted.
but, on cmd.exe i can't input chinese word.

Possible Solution

Additional context

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