On 25/11/21 7:57 pm, Côme Chilliet wrote: > Hello, > > The RFC is missing information about alternatives: > Do all of these function have an mbstring version?
The following functions have an mbstring version: strtolower, strtoupper, stristr, stripos, strripos. mb_convert_case() provides functionality equivalent to lcfirst, ucfirst and ucwords. There is no mbstring version of str_ireplace, that is https://bugs.php.net/bug.php?id=75225 There is no mbstring equivalent for the array sorting functions with SORT_FLAG_CASE, but there is Collator::asort() in intl. > Are those locale dependant or have an option for it? The mbstring functions are locale-independent. Unfortunately there do not seem to be PHP wrappers for the family of case conversion functions in ICU's ustring.h. There is IntlChar::tolower() and IntlChar::toupper(), but they provide locale-independent case conversion, equvialent to mbstring. It's not ideal to change the case of a string character by character, since some languages have multi-character mappings. ICU calls this context-sensitive case conversion. Considering the lack of wide character support or context-sensitive case conversion in the existing strtoupper/strtolower, I would consider this missing functionality rather than functionality which I am removing. > To reuse the example from the RFC, if I want to convert a UTF string to > uppercase using Turkish rules and get dotted capital I, what should I use? For case-insensitive comparison you can use Collator. But for display you just have to do it yourself. For the Turkish Wikipedia and other Turkic language websites we are currently using str_replace(). -- Tim Starling -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php