Req #67815 [Com]: strtolower/upper should be locale unaware for Turkish I
| From: | ongun dot kanat at gmail dot com | Date: | Mon, 11 Aug 2014 23:22:00 +0000 |
| Subject: | Req #67815 [Com]: strtolower/upper should be locale unaware for Turkish I | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-187084@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67815&edit=1
ID: 67815
Comment by: ongun dot kanat at gmail dot com
Reported by: ongun dot kanat at gmail dot com
Summary: strtolower/upper should be locale unaware for
Turkish I
Status: Not a bug
Type: Feature/Change Request
Package: Strings related
Operating System: Linux
PHP Version: 5.5.15
Block user comment: N
Private report: N
New Comment:
I know that it is not a bug. That is the why I opened this issue as "request".
I also know that str* functions work locale dependent and try to avoid them in the applications I
code or explicitly setting en_US or tr_TR as parameter in functions. Yet there are lots of software
uses str* functions to include its files, to change its mapped arrays' keys with these
functions not only for loading class-names. Fixing the strtouppers in every software I download is
utterly annoying. There should be a workaround which utilizes a locale-independent strtoupper/lower
or another functions. A php.ini setting would be awesome.
To avoid locales I have to change my system configuration and obviously I don't want to change
it to en_US.UTF-8 or something else. As [cankoy at ymail dot com] said in https://bugs.php.net/bug.php?id=18556 changing
LC_CTYPE or something else does not solve anything.
Previous Comments:
------------------------------------------------------------------------
[2014-08-11 18:43:03] nikic@php.net
strtolower and strotoupper work according to the current locale. The Turkish locale has that weird
behavior, so that's what you get.
The referenced bugs are not referring to strtolower/strtoupper, but to lower-casing used for
case-insensitive comparison of function names and other identifiers. That was a bug and was fixed by
using a locale-independent lower-casing function.
My general recommendation is to avoid locales and locale-dependent functions, as locales are a
fundamentally broken concept.
------------------------------------------------------------------------
[2014-08-11 14:11:03] ongun dot kanat at gmail dot com
I looked the bug below and found that the issue is 12 years old bug!
https://bugs.php.net/bug.php?id=18556
Although it's tagged closed and in the last comment [jpauli at php dot net] said it is fixed,
it still exists.
There is a RFC in wiki but it is about mbstring plugin as I see.
https://wiki.php.net/rfc/multibyte_char_handling?s[]=turkish
Maybe the functions strtolower/strtoupper would work for ASCII as default and a locale parameter for
other charsets. It will solve the most of the class loading problems in Turkish locale.
------------------------------------------------------------------------
[2014-08-10 07:36:08] fa@php.net
Related bugs:
https://bugs.php.net/bug.php?id=18556
https://bugs.php.net/bug.php?id=21771
https://bugs.php.net/bug.php?id=18556
https://bugs.php.net/bug.php?id=29955
Maybe there should be a FAQ entry on the wiki?
------------------------------------------------------------------------
[2014-08-09 18:44:22] ongun dot kanat at gmail dot com
Description:
------------
There are many applications written that uses strtoupper/strtolower like phpMyAdmin. The Turkish
'I','i' causes errors in these applications since strtolower and strtoupper
rejects the 'I'->'i'/'i'->'I' conversation on systems
with locale "tr_TR.UTF-8". The function may be locale unaware.
Test script:
---------------
<?php
header("Content-type:text/plain; charset=UTF-8");
echo strtolower("I") . "\n" . strtoupper("i");
Expected result:
----------------
i
I
Actual result:
--------------
I
i
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67815&edit=1