Doc #63663 [Ana->Csd]: str_word_count does not properly handle non-latin characters

From: Date: Wed, 31 Mar 2021 13:35:35 +0000
Subject: Doc #63663 [Ana->Csd]: str_word_count does not properly handle non-latin characters
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18680@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63663&edit=1 ID: 63663 Updated by: git@php.net Reported by: kobrien at kiva dot org Summary: str_word_count does not properly handle non-latin characters -Status: Analyzed +Status: Closed Type: Documentation Problem Package: Strings related Operating System: Ubuntu 12.04 PHP Version: 5.3.20-dev Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmb69 Revision: https://github.com/php/doc-en/commit/c73b00a6d7f799e3e5189a316efa06b7ef3c0fe6 Log: Fix #63663: str_word_count does not properly handle non-latin characters Previous Comments: ------------------------------------------------------------------------ [2021-03-31 13:33:12] cmb@php.net > […] it's something we'd need to think about as part of making > the whole language more multibyte-aware. That's unlikely going to happen, so I'm changing to doc bug. ------------------------------------------------------------------------ [2015-05-08 23:11:54] cmb@php.net Related To: Bug #65080 ------------------------------------------------------------------------ [2015-04-12 20:28:38] cmb@php.net Related To: Bug #27668 ------------------------------------------------------------------------ [2012-12-03 03:10:21] kobrien at kiva dot org Ok feature request filed here: https://bugs.php.net/bug.php?id=63671 First time doing that, so hopefully it's correctly filed. ------------------------------------------------------------------------ [2012-12-03 02:47:28] aharvey@php.net Yeah, a feature request for mb_str_word_count() might be a good idea. The isalpha() issue isn't really PHP specific: the underlying C function simply takes a single byte as its input, so it can't ascertain whether a multibyte character is actually alphanumeric or not (since it only ever gets the first byte of the sequence). There's an iswalpha() function that would do the right thing, but PHP was written before it was widely available, and using it in str_word_count() alone would be inconsistent with the rest of the language: it's something we'd need to think about as part of making the whole language more multibyte-aware. ------------------------------------------------------------------------ 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=63663 -- Edit this bug report at https://bugs.php.net/bug.php?id=63663&edit=1

« previous php.doc.bugs (#18680) next »