Re: RFC [Discussion]: mb_str_pad
| From: | Rowan Tommins | Date: | Sat, 20 May 2023 15:13:00 +0000 |
| Subject: | Re: RFC [Discussion]: mb_str_pad | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120370@lists.php.net to get a copy of this message | ||
On 20 May 2023 13:53:20 BST, Niels Dossche <dossche.niels@gmail.com> wrote:
>RFC: https://wiki.php.net/rfc/mb_str_pad
Hi Niels,
This seems like a reasonable addition. My only hesitation is that it will share with other mbstring
functions the slightly dubious definition of "character" as "code point", rather
than "grapheme", when dealing with Unicode strings.
This is most easily demonstrated using combining diacritics, e.g. "Franc\u{0327}ais" is 9
code points long, but visually identical to the 8 code point "Fran\u{00E7}ais" used in
your examples. Unicode defines "graphemes" or "grapheme clusters" to better
match the common intuition of what a "character" means.
Perhaps we should instead, or also, add a "grapheme_strpad" function to ext/intl?
Regards,
--
Rowan Tommins
[IMSoP]