Bug #81598 [Ver]: Cannot input unicode characters in PHP 8 interactive shell

From: Date: Tue, 09 Nov 2021 10:39:38 +0000
Subject: Bug #81598 [Ver]: Cannot input unicode characters in PHP 8 interactive shell
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237646@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81598&edit=1 ID: 81598 Updated by: nikic@php.net Reported by: 7snovic at gmail dot com Summary: Cannot input unicode characters in PHP 8 interactive shell Status: Verified Type: Bug Package: CGI/CLI related Operating System: Ubuntu 20 PHP Version: 8.0Git-2021-11-08 (snap) Block user comment: N Private report: N New Comment: I looked into the editline implementation a bit (apparently available at https://thrysoee.dk/editline/ as a tar.gz file only -- no version control) and it seems to be based entirely around wchar functionality, which is indeed locale-based. Something I tried and that seems to work is to use the "C.UTF-8" locale. I believe that should both make mbrtowc() work fine, and not introduce any locale-sensitivity in the single-byte functions used by PHP at the same time. Previous Comments: ------------------------------------------------------------------------ [2021-11-08 16:28:48] nikic@php.net From a quick test, calling setlocale() at the start of the session doesn't seem to work. It would be pretty bad UX as well. Though that gives me a tiny bit of hope that maybe it's sufficient to have the locale set during some kind of startup procedure, and we can use the C locale afterwards. ------------------------------------------------------------------------ [2021-11-08 16:14:52] cmb@php.net > The relevant change here is probably that PHP 8 no longer > inherits the ctype locale from environment. Ah, so this would be rather a documentation issue, telling users to call setlocale() at the start of their session? ------------------------------------------------------------------------ [2021-11-08 16:07:16] nikic@php.net (Undoing concurrent status changes) ------------------------------------------------------------------------ [2021-11-08 16:06:54] nikic@php.net I can reproduce this. And I can also reproduce on 7.4 when running with "LANG=C php7.4 -a". The relevant change here is probably that PHP 8 no longer inherits the ctype locale from environment. ------------------------------------------------------------------------ [2021-11-08 16:06:29] cmb@php.net Thanks for the swift reply! I have no idea what might have changed in PHP 8, and I'm usually working on Windows, I'll pass on this one. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=81598 -- Edit this bug report at https://bugs.php.net/bug.php?id=81598&edit=1

« previous php.bugs (#237646) next »