Skip to content

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

Closed

Description

@grmblfrz

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

Activity

  1. youkidearitai commented on Apr 3, 2025

    @youkidearitai
    Contributor

    Maybe this seems not include in DerivedCoreProperties.txt.

  2. youkidearitai commented on May 29, 2025

    @youkidearitai
    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?

  3. alexdowad commented on Jun 8, 2025

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

  4. alexdowad commented on Nov 9, 2026

    @alexdowad
    Contributor

    Closing this one. Feel free to re-open if anyone has further input.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions