Bug #68414 [Wfx]: Yet another strtolower/upper problem in tr_TR

From: Date: Mon, 17 Nov 2014 10:33:41 +0000
Subject: Bug #68414 [Wfx]: Yet another strtolower/upper problem in tr_TR
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188633@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68414&edit=1 ID: 68414 User updated by: julien at palard dot fr Reported by: julien at palard dot fr Summary: Yet another strtolower/upper problem in tr_TR Status: Wont fix Type: Bug Package: mbstring related Operating System: all PHP Version: 5.5.18 Block user comment: N Private report: N New Comment: I understand that mb_* functions are not local aware, so let's stick to: mb_strtoupper('i', 'UTF-8') -> I mb_strtolower('I', 'UTF-8') -> i And I understand that strtolower and strtoupper are not multibyte aware, so they just can't work with utf-8. Maybe PHP needs a localized multibytes set of functions ? Previous Comments: ------------------------------------------------------------------------ [2014-11-13 19:35:01] aharvey@php.net Ultimately, mbstring just isn't locale aware — although there's a hack in the code to handle ISO-8859-9 strings differently, I don't really think there's a sensible way to handle this in the general case given the limitations of mbstring's API. ------------------------------------------------------------------------ [2014-11-13 14:02:08] julien at palard dot fr Description: ------------ Lots of bugs have beed opened on this subject, lots of bugs have beed closed / resolved / etc : https://bugs.php.net/search.php?search_for=turkish&boolean=0&limit=30&order_by=&direction=DESC&cmd=display&status=All&bug_type=All&project=All&php_os=&phpver=&cve_id=&assign=&author_email=&bug_age=0&bug_updated=0 Those bugs typically address iso8859-9, the latin-5 character encoding used in Turkey, this one addresses the UTF8 encoding: In turkish: SMALL I capitalized is CAPITAL I WITH DOT ABOVE (and vice-versa) SMALL DOTLESS I capitalized CAPITAL I (and vice-versa) In PHP I got (see test script) Expects CAPITAL I WITH DOT ABOVE: iI Expects SMALL I WITHOUT DOT: Ii Which is, more or less, wrong for the 4 tests. Test script: --------------- <?php mb_internal_encoding('UTF-8'); setlocale(LC_ALL, 'tr_TR.UTF-8'); echo "Expects CAPITAL I WITH DOT ABOVE: " . strtoupper('i') . mb_strtoupper('i', 'UTF-8') . PHP_EOL; echo "Expects SMALL I WITHOUT DOT: " . strtolower('I') . mb_strtolower('I', 'UTF-8') . PHP_EOL; Expected result: ---------------- Expects CAPITAL I WITH DOT ABOVE: İİ Expects SMALL I WITHOUT DOT: ıı Actual result: -------------- Expects CAPITAL I WITH DOT ABOVE: iI Expects SMALL I WITHOUT DOT: Ii ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68414&edit=1

« previous php.bugs (#188633) next »