How to read non-ASCII characters from CLI standard input
If I type å in CMD, fgets stop waiting for more input and the loop runs until I press ctrl-c . If I type a "normal" characters like a-z0-9!?() it works as expected. I run the code in CMD under Windows 7 with UTF-8 as charset ( chcp 65001 ), the file is saved as UTF-8 without bom. I use PHP 5.3.5 (cli). <?php echo "ÅÄÖåäö work here.\n"; while(1) { echo '> '. fgets(STDIN); } ?> If I change charset to chcp 1252 the loop doesn't break when I type å and it print "> å" but the "ÅÄÖåäö work here" become "ÅÄÖåäö work here!". And I know that I can change the file to ANSI, but then I can't use