0

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:
> علي
< ""

  • 1
    Looks PowerShell specific. Testing that with WSL2 Ubuntu22 works fine. – Markus Zeller May 06 '22 at 16:45
  • Does this answer your question? [How to read non-ASCII characters from CLI standard input](https://stackoverflow.com/questions/8331353/how-to-read-non-ascii-characters-from-cli-standard-input) – JosefZ May 07 '22 at 15:51

0 Answers0