Req #70072 [Opn]: Add a language avare uppercase/lowercase solution without need of locale change

From: Date: Fri, 28 Jul 2017 10:47:42 +0000
Subject: Req #70072 [Opn]: Add a language avare uppercase/lowercase solution without need of locale change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210396@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70072&edit=1

 ID:                 70072
 Updated by:         nikic@php.net
 Reported by:        ongun dot kanat at gmail dot com
 Summary:            Add a language avare uppercase/lowercase solution
                     without need of locale change
 Status:             Open
 Type:               Feature/Change Request
 Package:            mbstring related
 Operating System:   any
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

In master the first two cases will now work correctly. The latter two do not, as these are
language-specific conditional special case mappings, which are currently not implemented.


Previous Comments:
------------------------------------------------------------------------
[2015-07-14 13:14:07] ongun dot kanat at gmail dot com

Description:
------------
Using many languages in one page(at the same time) is possible when your clients work
globally/multilingual. And sometimes developers like me are struggling in implement a page
uses/modifies strings from many languages at the same time. And sometimes it's just meaningless
to change locale of whole page for just one string. It would be awesome a parameter to change
language in mbstring upper/lowercase operations.

Example case
I am displaying a page in English but also displaying strings in languages below:
ß -> SS in German, ı->I in Turkish

Unicode already has mappings for chars and special cases.
http://unicode.org/faq/casemap_charprop.html#1

Test script:
---------------
<?php
mb_internal_encoding("UTF-8");
echo mb_strtoupper("Maß\n");  // "MAß"
echo mb_strtolower("MAẞ\n");  // "maß"

echo mb_strtoupper("ilaç\n"); // "ILAÇ"
echo mb_strtolower("IŞIK\n"); // "iŞik"
?>

Expected result:
----------------
MASS // Eszett
maß
İLAÇ // Turkish I issue
ışık

Actual result:
--------------
MAß
maß
ILAÇ
iŞik


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70072&edit=1


Thread (2 messages)

« previous php.bugs (#210396) next »