MB_CASE_TITLE treats entities as words (in contrast to uc_words)
Open
Nobody has claimed this yet.
Bug
Extension: mbstring
Status: Needs Triage
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the mb_convert_case entry point and reproduce the reported PHP 8.4.5 and 8.2.26 behavior using the supplied acme & co example. The work is done when title casing preserves the entity as & while still producing Acme and Co, with regression coverage for the reported input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- internationalization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100