[php-src] Issue #8096: mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); doesn't convert the Greek last letter to ς but to σ
| From: | alexdowad | Date: | Sat, 09 Apr 2022 10:52:57 +0000 |
| Subject: | [php-src] Issue #8096: mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); doesn't convert the Greek last letter to ς but to σ | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240813@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8096
Comment Author: alexdowad
If we have a significant number of e.g. Lithuanian users, I wonder if we might introduce a variant
of
mb_strtolower called mb_strtolower_lithuanian or something like that.
I think auto-detecting the user's locale and changing behavior based on it is fraught with
problems. First, the locale on the computer where software is tested may not be the same as the
locale where it runs. Second, for web-based software, the locale on the web server may not be the
same as the locale of the users. When you change behavior based on the machine's locale, you
are introducing an extra piece of implicit global state, with all the problems which implicit global
state presents in general.
Better to let the programmer be explicit about what they want. If we did have
mb_strtolower_lithuanian, I don't expect that most mbstring users
would ever take notice of it, but Lithuanians who were writing web apps intended for use by other
Lithuanians might.
Of course, said Lithuanians could also implement their language's casing rules in user code, if
they wanted to.
Maybe mb_strtolower_lithuanian is a terrible idea. But if we are going to implement
those language-specific rules, definitely the choice of rules needs to be made explicit.
mb_language is explicit, but I don't know if it is the right choice for this
purpose. As @cmb69 said, it is already used for another purpose.
I trust @nikic and @cmb69 on whether implementing these features is useful or not, and what the
interface should be like. I'm happy to do the actual implementation.
By the way, @nikic and @cmb69, since you are both more experienced C programmers than I, can I ask
whether you agree that including "locales" in POSIX/ANSI C was probably a bad idea? It
seems to me that localization should probably have been handled at a higher level of the stack than
libc.
It would also be appreciated if you guys can review #8257, which will help to keep
mbstring moving forward.