php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #70072 Add a language avare uppercase/lowercase solution without need of locale change
Submitted: 2015-07-14 13:14 UTC Modified: 2017-07-28 10:47 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:1 (25.0%)
From: ongun dot kanat at gmail dot com Assigned:
Status: Open Package: mbstring related
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ongun dot kanat at gmail dot com
New email:
PHP Version: OS:

 

 [2015-07-14 13:14 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-28 10:47 UTC] nikic@php.net
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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 10:01:27 2019 UTC