Skip to content

MB_CASE_TITLE treats entities as words (in contrast to uc_words) #18236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
grmblfrz opened this issue Apr 3, 2025 · 3 comments
Open

MB_CASE_TITLE treats entities as words (in contrast to uc_words) #18236

grmblfrz opened this issue Apr 3, 2025 · 3 comments

Comments

@grmblfrz
Copy link

grmblfrz commented Apr 3, 2025

Description

The following code:

<?php
$txt = 'acme &amp; 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 &amp; Co

Using uc_words produces the expected result:

<?php
$txt = 'acme &amp; co';

echo ucwords($txt), PHP_EOL;

results in

Acme &amp; Co

PHP Version

PHP 8.4.5, PHP 8.2.26

Operating System

No response

@youkidearitai
Copy link
Contributor

Maybe this seems not include in DerivedCoreProperties.txt.

@youkidearitai
Copy link
Contributor

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 &amp;. That result is &Amp;

By the way, if fix(modify) this issue, this is BC breaks.

Please see also:

@alexdowad What do you think?

@alexdowad
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants