# [VOTE][RFC] mb_ucfirst and mb_lcfirst functions

- Thread: https://externals.io/message/122271
- Original archive: https://news-web.php.net/php.internals/122271
- Started by youkidearitai on 2024-02-02T00:59:54+00:00
- Messages: 15
- RFC: Multibyte for ucfirst and lcfirst functions (Implemented (PHP 8.4)) — https://externals.io/rfc/mb_ucfirst.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #122271 — youkidearitai — 2024-02-02T00:59:54+00:00

URL: https://externals.io/message/122271#122271

Hi, Internals

I have just opened the voting "Multibyte ucfirst and lcfirst functions" RFC.
https://wiki.php.net/rfc/mb_ucfirst

Voting will be open until February 26th, 2024 at 01:00 UTC.

Cheers
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122273 — Lynn — 2024-02-02T08:15:53+00:00

URL: https://externals.io/message/122271#122273 · In reply to: #122271

On Fri, Feb 2, 2024 at 2:00 AM youkidearitai <youkidearitai@gmail.com>
wrote:

> Hi, Internals
>
> I have just opened the voting "Multibyte ucfirst and lcfirst functions"
> RFC.
> https://wiki.php.net/rfc/mb_ucfirst
>
> Voting will be open until February 26th, 2024 at 01:00 UTC.
>
> Cheers
> Yuya
>
> --
> ---------------------------
> Yuya Hamada (tekimen)
> - https://tekitoh-memdhoi.info
> - https://github.com/youkidearitai
> -----------------------------
>
> --
> 
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>
In the proposal part is mentioned "From what I've researched with Unicode,
it may not behave as expected in some languages. In that case, please deal
with it in userland.". If my understanding here is wrong, please correct
me. ucfirst and lcfirst are to uppercase/lowercase the first character of a
word for characters that have an upper/lower case variant. Whether or not a
word _should_ have an uppercase or lower case character is not important
and currently doesn't behave in such a way for ucfirst and lcfirst. To me
this isn't unexpected behavior, that's exactly how I would expect it to
behave.

---

## #122275 — Ayesh Karunaratne — 2024-02-02T09:15:16+00:00

URL: https://externals.io/message/122271#122275 · In reply to: #122273

>
> On Fri, Feb 2, 2024 at 2:00 AM youkidearitai <youkidearitai@gmail.com>
> wrote:
>
> > […]
> In the proposal part is mentioned "From what I've researched with Unicode,
> it may not behave as expected in some languages. In that case, please deal
> with it in userland.". If my understanding here is wrong, please correct
> me. ucfirst and lcfirst are to uppercase/lowercase the first character of a
> word for characters that have an upper/lower case variant. Whether or not a
> word _should_ have an uppercase or lower case character is not important
> and currently doesn't behave in such a way for ucfirst and lcfirst. To me
> this isn't unexpected behavior, that's exactly how I would expect it to
> behave.
>

I think the author refers to the potential edge cases in certain Unicode
mappings. There isn't an ucfirst  mapping, but there are uppercase and
titlecase mappings.

Unicode titlecase mapping is different from uppercase mapping. This PR
seems to be using uppercase mapping. This should not matter for a vast
majority of characters, except for ligatures and digraphs.

I'm not at all and expert in these edge cases, but I just wanted to put my
two cents forth that I personally think using titlecase mapping on the
first word would be the more appropriate approach.

Thank you.

---

## #122276 — youkidearitai — 2024-02-02T09:27:24+00:00

URL: https://externals.io/message/122271#122276 · In reply to: #122275

2024年2月2日(金) 18:15 Ayesh Karunaratne <ayesh@php.watch>:
> > […]
>
>
> I think the author refers to the potential edge cases in certain Unicode mappings. There isn't an ucfirst  mapping, but there are uppercase and titlecase mappings.
>
> Unicode titlecase mapping is different from uppercase mapping. This PR seems to be using uppercase mapping. This should not matter for a vast majority of characters, except for ligatures and digraphs.
>
> I'm not at all and expert in these edge cases, but I just wanted to put my two cents forth that I personally think using titlecase mapping on the first word would be the more appropriate approach.
>
> Thank you.

Hi, Thank you for reply.

>
> I think the author refers to the potential edge cases in certain Unicode mappings. There isn't an ucfirst  mapping, but there are uppercase and titlecase mappings.
>

Yes, Ayesh is right.
This is a text that is the result of investigating edge cases.

> I'm not at all and expert in these edge cases, but I just wanted to put my two cents forth that I personally think using titlecase mapping on the first word would be the more appropriate approach.

I see. I'll change mb_ucfirst using titlecase.
Thank you.

Regards
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122289 — Tim Starling — 2024-02-05T23:33:06+00:00

URL: https://externals.io/message/122271#122289 · In reply to: #122276

> I see. I'll change mb_ucfirst using titlecase.

Per my comments a month ago on the GitHub issue , I think it is much 
better to use title case for `mb_ucfirst()` than to use upper case, 
since conversion of the first character to upper case has the effect 
of corrupting text in the Georgian script, and initial lower-case 
ligatures are converted to a form which appears like two upper case 
letters. So I'm pleased to see this change to the PR.

I would appreciate it if the RFC could also be updated to include this 
detail, since my vote depends on whether title case or upper case will 
be used.

-- Tim Starling

---

## #122290 — youkidearitai — 2024-02-06T02:40:10+00:00

URL: https://externals.io/message/122271#122290 · In reply to: #122289

2024年2月6日(火) 8:33 Tim Starling <tstarling@wikimedia.org>:
>
> 
>
> I see. I'll change mb_ucfirst using titlecase.
>
> Per my comments a month ago on the GitHub issue , I think it is much better to use title case for `mb_ucfirst()` than to use upper case, since conversion of the first character to upper case has the effect of corrupting text in the Georgian script, and initial lower-case ligatures are converted to a form which appears like two upper case letters. So I'm pleased to see this change to the PR.
>
> I would appreciate it if the RFC could also be updated to include this detail, since my vote depends on whether title case or upper case will be used.
>
> -- Tim Starling

Hi, Tim

Thank you for your comment.
I modified to "uses unicode case title" in an RFC.

Regards
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122307 — Juliette Reinders Folmer — 2024-02-06T17:55:44+00:00

URL: https://externals.io/message/122271#122307 · In reply to: #122290

> 2024年2月6日(火) 8:33 Tim Starling <tstarling@wikimedia.org>:
> > […]
> Hi, Tim
>
> Thank you for your comment.
> I modified to "uses unicode case title" in an RFC.
>
> Regards
> Yuya
>

Help me out here, but doesn't changing what is actually proposed in an 
RFC **after** the vote has started invalidate the vote ?

Shouldn't the vote be closed/withdrawn and restarted in that case ?

---

## #122311 — youkidearitai — 2024-02-06T19:49:25+00:00

URL: https://externals.io/message/122271#122311 · In reply to: #122307

2024年2月7日(水) 2:56 Juliette Reinders Folmer <php-internals_nospam@adviesenzo.nl>:
>
> 
> > […]
>
> Help me out here, but doesn't changing what is actually proposed in an
> RFC **after** the vote has started invalidate the vote ?
>
> Shouldn't the vote be closed/withdrawn and restarted in that case ?

Hi, Internals.

Juliette, Thank you for pointing.
I'm mistake.

I checked the following and it was exactly as I said.
https://wiki.php.net/RFC/voting#voting

> A valid voting period must be declared when voting is started and must not be changed during the vote.

I broke this rule. In this case, should I return to "Under discussion"?
I apologize to those who voted, admitting lack of discussion, I want
to reorganize.

Regards
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122317 — youkidearitai — 2024-02-06T20:19:45+00:00

URL: https://externals.io/message/122271#122317 · In reply to: #122311

2024年2月7日(水) 4:49 youkidearitai <youkidearitai@gmail.com>:
>
> 2024年2月7日(水) 2:56 Juliette Reinders Folmer <php-internals_nospam@adviesenzo.nl>:
> > […]
>
> Hi, Internals.
>
> Juliette, Thank you for pointing.
> I'm mistake.
>
> I checked the following and it was exactly as I said.
> https://wiki.php.net/RFC/voting#voting
>
> > […]
>
> I broke this rule. In this case, should I return to "Under discussion"?
> I apologize to those who voted, admitting lack of discussion, I want
> to reorganize.
>
> Regards
> Yuya

Hi, Internals.
This an RFC is revert to "Under Discussion".

https://wiki.php.net/rfc/howto
Referenced Section 7.3:
> A serious issue with your RFC needs to be addressed: update the status of your RFC page and its section on https://wiki.php.net/RFC to “Under Discussion” and continue again from step 5.

I would like to wait another two weeks to vote again.
Scheduled for February 21st, GMT 00:00 restart voting.

Please feel free to comment.

I apologize to everyone who voted again.

Regards
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122321 — Ayesh Karunaratne — 2024-02-07T02:43:30+00:00

URL: https://externals.io/message/122271#122321 · In reply to: #122289

> > […]
>
> Per my comments a month ago on the GitHub issue , I think it is much
> better to use title case for `mb_ucfirst()` than to use upper case,
> since conversion of the first character to upper case has the effect
> of corrupting text in the Georgian script, and initial lower-case
> ligatures are converted to a form which appears like two upper case
> letters. So I'm pleased to see this change to the PR.
>
> I would appreciate it if the RFC could also be updated to include this
> detail, since my vote depends on whether title case or upper case will
> be used.
>
> -- Tim Starling
>

Hi Tim,
Now that the RFC is restarted, could you mention some examples in Georgian
that might be good test cases?

I was thinking there might be some good test cases in Turkish, but couldn't
find any. The RFC has examples (https://github.com/php/php-src/pull/13161)
in Vietnamese, but they are correct for both "uppercase first character"
and titlecase conversions.

Thank you.

---

## #122322 — Tim Starling — 2024-02-07T03:56:40+00:00

URL: https://externals.io/message/122271#122322 · In reply to: #122321

>
> Hi Tim,
> Now that the RFC is restarted, could you mention some examples in 
> Georgian that might be good test cases?
>
> I was thinking there might be some good test cases in Turkish, but 
> couldn't find any. The RFC has examples 
> (https://github.com/php/php-src/pull/13161) in Vietnamese, but they 
> are correct for both "uppercase first character" and titlecase 
> conversions.

Any Georgian word would do. Your ASCII test case is "abc". The 
Georgian equivalent for that would be "აბგ" (ani bani gani, U+10D0 
U+10D1 U+10D2) which should remain the same after passing through 
 `mb_ucfirst()`. Compare mb_strtoupper("აბგ") -> "ᲐᲑᲒ" (U+1C90 U+1C91 
U+1C92).

On the task I mentioned that ligatures are also affected. I gave the 
example mb_ucfirst("ǉ") -> "ǈ", that is, U+01C9 -> U+01C8. You could 
add a test case for that. Compare mb_strtoupper("ǉ") -> "Ǉ" (U+01C7).

To repeat my rationale -- we can view `ucfirst()` either through a 
technical lens (convert the first character of a string to upper case) 
or through a natural language lens (convert a string to sentence case, 
with the initial letter capitalised per local conventions). I am 
arguing to make `mb_ucfirst()` be a natural language extension of 
 `ucfirst()`, because applying the technical extension would produce 
results that look quite jarring in a natural language context.

There are some edge cases which are not quite right. To really do a 
good job, a new case map will be needed. But if we document it as 
being for natural language, and set the right expectations, we can fix 
the edge cases later.

-- Tim Starling

---

## #122340 — youkidearitai — 2024-02-08T08:03:32+00:00

URL: https://externals.io/message/122271#122340 · In reply to: #122322

2024年2月7日(水) 12:56 Tim Starling <tstarling@wikimedia.org>:
>
> 
> > […]
>
> Any Georgian word would do. Your ASCII test case is "abc". The
> Georgian equivalent for that would be "აბგ" (ani bani gani, U+10D0
> U+10D1 U+10D2) which should remain the same after passing through
> `mb_ucfirst()`. Compare mb_strtoupper("აბგ") -> "ᲐᲑᲒ" (U+1C90 U+1C91
> U+1C92).
>
> On the task I mentioned that ligatures are also affected. I gave the
> example mb_ucfirst("ǉ") -> "ǈ", that is, U+01C9 -> U+01C8. You could
> add a test case for that. Compare mb_strtoupper("ǉ") -> "Ǉ" (U+01C7).
>
> To repeat my rationale -- we can view `ucfirst()` either through a
> technical lens (convert the first character of a string to upper case)
> or through a natural language lens (convert a string to sentence case,
> with the initial letter capitalised per local conventions). I am
> arguing to make `mb_ucfirst()` be a natural language extension of
> `ucfirst()`, because applying the technical extension would produce
> results that look quite jarring in a natural language context.
>
> There are some edge cases which are not quite right. To really do a
> good job, a new case map will be needed. But if we document it as
> being for natural language, and set the right expectations, we can fix
> the edge cases later.
>
> -- Tim Starling
>

Hi, Tim
Thank you for Georgian test case.
I added to test case.

If other any comments, please feel free.

Regards
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122434 — youkidearitai — 2024-02-19T09:55:15+00:00

URL: https://externals.io/message/122271#122434

---------- Forwarded message ---------
From: youkidearitai <youkidearitai@gmail.com>
Date: 2024年2月19日(月) 18:46
Subject: Re: [PHP-DEV][VOTE][RFC] mb_ucfirst and mb_lcfirst functions
To: <internals@lists.php.net>


2024年2月7日(水) 5:19 youkidearitai <youkidearitai@gmail.com>:
>
> 2024年2月7日(水) 4:49 youkidearitai <youkidearitai@gmail.com>:
> > […]
>
> Hi, Internals.
> This an RFC is revert to "Under Discussion".
>
> https://wiki.php.net/rfc/howto
> Referenced Section 7.3:
> > […]
>
> I would like to wait another two weeks to vote again.
> Scheduled for February 21st, GMT 00:00 restart voting.
>
> Please feel free to comment.
>
> I apologize to everyone who voted again.
>
> Regards
> Yuya
>
> --
> ---------------------------
> Yuya Hamada (tekimen)
> - https://tekitoh-memdhoi.info
> - https://github.com/youkidearitai
> -----------------------------

I send below message, but kicked by internals. Resend to it.

Hi, Internals.
This is a reminder.

If nothing another comments, This an RFC restart voting at February
21st, GMT 00:00.
Thank you.

Regards
Yuya

--
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122444 — youkidearitai — 2024-02-21T00:16:38+00:00

URL: https://externals.io/message/122271#122444 · In reply to: #122434

2024年2月19日(月) 18:55 youkidearitai <youkidearitai@gmail.com>:
>
> ---------- Forwarded message ---------
> From: youkidearitai <youkidearitai@gmail.com>
> Date: 2024年2月19日(月) 18:46
> Subject: Re: [PHP-DEV][VOTE][RFC] mb_ucfirst and mb_lcfirst functions
> To: <internals@lists.php.net>
>
>
> 2024年2月7日(水) 5:19 youkidearitai <youkidearitai@gmail.com>:
> > […]
>
> I send below message, but kicked by internals. Resend to it.
>
> Hi, Internals.
> This is a reminder.
>
> If nothing another comments, This an RFC restart voting at February
> 21st, GMT 00:00.
> Thank you.
>
> Regards
> Yuya
>
> --
> ---------------------------
> Yuya Hamada (tekimen)
> - https://tekitoh-memdhoi.info
> - https://github.com/youkidearitai
> -----------------------------

Hi, Internals.

Restarted voting phase to Multibyte for ucfirst, lcfirst functions,
mb_ucfirst mb_lcfirst.
https://wiki.php.net/rfc/mb_ucfirst

Voting end at March 7th 00:00:00 GMT.

Thanks
Yuya

-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai

---

## #122581 — youkidearitai — 2024-03-07T01:38:57+00:00

URL: https://externals.io/message/122271#122581 · In reply to: #122444

2024年2月21日(水) 9:16 youkidearitai <youkidearitai@gmail.com>:
>
> 2024年2月19日(月) 18:55 youkidearitai <youkidearitai@gmail.com>:
> > […]
>
> Hi, Internals.
>
> Restarted voting phase to Multibyte for ucfirst, lcfirst functions,
> mb_ucfirst mb_lcfirst.
> https://wiki.php.net/rfc/mb_ucfirst
>
> Voting end at March 7th 00:00:00 GMT.
>
> Thanks
> Yuya
>
> --
> ---------------------------
> Yuya Hamada (tekimen)
> - https://tekitoh-memdhoi.info
> - https://github.com/youkidearitai
> -----------------------------

Hi, Internals
The RFC has been ended. Result is accepted (yes: 14, no: 0)

Thank you very much for voting.

Regards
Yuya


-- 
---------------------------
Yuya Hamada (tekimen)
- https://tekitoh-memdhoi.info
- https://github.com/youkidearitai
