Homec4science

Introduce libphutil UTF8 case changing functions

Authored by epriestley <git@epriestley.com> on Mar 3 2013, 19:56.

Description

Introduce libphutil UTF8 case changing functions

Summary:
Ref T2632. To fix one of the issues there, we need to be able to call ucwords() on utf8 strings. Currently, ucwords() mangles utf8 strings destructively. For example:

$ php -r 'echo ucwords("\xE9\xBA\x9F");' | icat
\xc9\xba\x9f
^^^^
WTF?

Write a wrapper function instead. These wrappers should work okay if mbstring is available; probably not as well without it.

I've been very conservative in my implementation of ucwords() to avoid doing anything crazy with languages I don't speak. We can refine these later.

Test Plan: Added unit tests.

Reviewers: AnhNhan, chad, vrana

Reviewed By: AnhNhan

CC: aran

Maniphest Tasks: T2632

Differential Revision: https://secure.phabricator.com/D5191

Details

Committed
epriestley <git@epriestley.com>Mar 3 2013, 19:56
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU09ea05659978: Restore older SimpleOptions parsing behavior for values with spaces
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU38996e6111f5: Introduce libphutil UTF8 case changing functions (authored by epriestley <git@epriestley.com>).Mar 3 2013, 19:56