php stdin input return blank value with arabic chars

62 Views Asked by At

i'm makin my own php cli but i need to use arabic letters
so fgets return blank value from command line input
Knowing i'm using powershell to run commands

function input(string $prompt = null) {
   echo "$prompt\r\n";
   $handle = fopen ("php://stdin","r");
   $output = fgets ($handle);
   return trim ($output);
}
var_dump(input("Enter Arabic Word: "));

terminal preview :

> php cli.php
< Enter Arabic Word:
> علي
< ""

0

There are 0 best solutions below