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

From: Date: Sun, 05 Dec 2021 20:04:22 +0000
Subject: Bug #81598 [Ver->Csd]: Cannot input unicode characters in PHP 8 interactive shell
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238204@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:         git@php.net
 Reported by:        7snovic at gmail dot com
 Summary:            Cannot input unicode characters in PHP 8 interactive
                     shell
-Status:             Verified
+Status:             Closed
 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:

Automatic comment on behalf of nikic
Revision: https://github.com/php/php-src/commit/26e424465c4d6848d19bcf041c6110ff155df840
Log: Fix bug #81598: Use C.UTF-8 as LC_CTYPE locale by default


Previous Comments:
------------------------------------------------------------------------
[2021-11-09 11:07:20] nikic@php.net

The following pull request has been associated:

Patch Name: Fix bug #81598: Use C.UTF-8 as LC_CTYPE locale by default
On GitHub:  https://github.com/php/php-src/pull/7635
Patch:      https://github.com/php/php-src/pull/7635.patch

------------------------------------------------------------------------
[2021-11-09 10:39:38] nikic@php.net

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.

------------------------------------------------------------------------
[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)

------------------------------------------------------------------------


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


Thread (13 messages)

« previous php.bugs (#238204) next »