MB_CASE_TITLE treats entities as words (in contrast to uc_words)
Description
The following code:
<?php
$txt = 'acme & co';
echo mb_convert_case($txt, MB_CASE_TITLE, 'UTF-8'), PHP_EOL;
Resulted in this output:
Acme &Amp; Co
But I expected this output instead:
Acme & Co
Using uc_words produces the expected result:
<?php
$txt = 'acme & co';
echo ucwords($txt), PHP_EOL;
results in
Acme & Co
PHP Version
PHP 8.4.5, PHP 8.2.26
Operating System
No response
Maybe this seems not include in DerivedCoreProperties.txt.
I think this is not a bug. Because mb_convert_case is depends on Unicode.
In this case, & is not alphabet. And it is not include at "Case_Ignorable" in DerivedCorePreperties.txt.
Therefore, mb_convert_case can't convert to &. That result is &Amp;
By the way, if fix(modify) this issue, this is BC breaks.
Please see also:
- https://bugs.php.net/bug.php?id=65544
- https://bugs.php.net/bug.php?id=46607
@alexdowad What do you think?
@grmblfrz, thanks for the report. As @youkidearitai said, mb_convert_case is intended to follow the case conversion algorithms in the Unicode standard.
If it doesn't, please feel free to open a bug report and show us in what way mb_convert_case does not follow the Unicode standard.
Showing us that it doesn't behave the same as ucwords doesn't mean much, because it is not intended to follow the behavior of ucwords.
Closing this one. Feel free to re-open if anyone has further input.