On Fri, Sep 17, 2021 at 12:07 PM Tim Starling <tstarl...@wikimedia.org> wrote:
> On 17/9/21 7:15 pm, Kamil Tekiela wrote: > > +1 from me. I wasn't even aware that these functions are > > locale-dependent until recently. I see an added benefit that we could > > add them to the optimizer once they are no longer locale-dependent. > > What would happen to users who really need the locale-dependent > > functions? Do we offer some workarounds? > > We could add a global mode, although that would prevent constant > propagation, if that's what you mean by adding them to the optimizer. > Or we could add variant functions like locale_strtolower() and > locale_strtoupper(). But I think I would want to hear from someone who > uses locale-dependence so I can understand what their needs are. I > guess the RFC will sort that out. > I would expect that in nearly all cases the replacement would be one of these: 1. You were using an UTF-8 locale (which you likely are), then just keep using strtolower(). Without having checked all the details here, I think strtolower() under UTF-8 locales already effectively behaves like ASCII lowercase, because it skips continuation bytes. 2. If you were using some other charset, then using mb_strtolower() with that charset should work. So if you were using de_DE.ISO8859-1, then using mb_strtolower() with "ISO8859-1" encoding would be the replacement. As a matter of general policy, it is unlikely that we will accept an option (whether that be an ini option or something else) to control this behavior. We can make the change or not make it, but not both ;) Regards, Nikita