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

Skip to content

Console cyrillic input chars #37619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
infureal opened this issue Jul 20, 2020 · 10 comments
Closed

Console cyrillic input chars #37619

infureal opened this issue Jul 20, 2020 · 10 comments

Comments

@infureal
Copy link

Symfony version(s) affected: symfony/[email protected]

Description
Cannot pass cyrillic chars to console input.

How to reproduce

$io = new SymfonyStyle($input, $output);
$name = $io->ask('Write name', 'Default');
var_dump($name);

Output

 Write name [Default]:
 > Имя

string(7) "Default"
@infureal infureal added the Bug label Jul 20, 2020
@infureal infureal changed the title Cyrillic input chars Console cyrillic input chars Jul 20, 2020
@xabbuh xabbuh added the Console label Jul 21, 2020
@andreyserdjuk
Copy link
Contributor

Could not represent. Need more info about env: OS, PHP version. If it's a dockerized app it would be good to have image data.

@infureal
Copy link
Author

infureal commented Aug 3, 2020

  • PHP 7.3.9
  • Windows 10 Pro [build 18362.959]

@YaFou
Copy link
Contributor

YaFou commented Aug 4, 2020

Please upgrade to version 5.1.3. See #37385. This should fix your issue.

@infureal
Copy link
Author

infureal commented Aug 8, 2020

  • Updated to 5.1.3
  • Test was same as starting message
    No, this doesn't fix this. It can read chars, but writes question marks instead valid input.

Maybe it only my problem with my cmd/powershell, idk anyway

@YaFou
Copy link
Contributor

YaFou commented Aug 8, 2020

  • Updated to 5.1.3
  • Test was same as starting message
    No, this doesn't fix this. It can read chars, but writes question marks instead valid input.

Maybe it only my problem with my cmd/powershell, idk anyway

I don't really understand what do you mean by writing the question marks instead the input: the question marks is written and when you type these characters, the default input is printed? Maybe the CMD does not support these specific characters.


Can you try this example in a simple PHP script?

<?php

echo 'Type here: ';
$input = readline();
echo $input;

@infureal

@infureal
Copy link
Author

infureal commented Aug 8, 2020

Type here: Привет
Привет

Yeap, as expected, got me same input

@infureal
Copy link
Author

infureal commented Aug 8, 2020

writing the question marks

Nope, output writes questions marks

@YaFou
Copy link
Contributor

YaFou commented Aug 9, 2020

Type here: Привет
Привет

Yeap, as expected, got me same input

So, it's not your terminal that throw this issue apparently. However you should investigate about the encoding with sapi_windows_cp_set. Apparently, my fix did not cover all cases.

@YaFou
Copy link
Contributor

YaFou commented Aug 23, 2020

Hi @infureal!

I've done some tests on my local machine but I did not find any solution for your issue 😔 However, there is some code page which works: 855 and 866 that you can define with the function sapi_windows_cp_set (see here & this function only works on Windows). However, with this code page, it will break other characters like é or â.

@infureal
Copy link
Author

@YaFou
It seems that my PowerShell is broken... I had to fix that and if 'bug' isn't disapere - I'll open new issue with more derails.
(Sorry for my englandsky 😄)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants