Bug #77375 [Opn->Nab]: mb_strtolower carries accents to next character

From: Date: Tue, 06 Apr 2021 11:57:44 +0000
Subject: Bug #77375 [Opn->Nab]: mb_strtolower carries accents to next character
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233214@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77375&edit=1 ID: 77375 Updated by: cmb@php.net Reported by: sjon at hortensius dot net Summary: mb_strtolower carries accents to next character -Status: Open +Status: Not a bug Type: Bug Package: mbstring related Operating System: archlinux PHP Version: 7.3.0 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > […] and I'm not sure why it's specified to behave the way it > does. I assume that is to not loose information (e.g. for a later mb_strtoupper(): <https://3v4l.org/gA2aH>). > The fact that the dot is rendered over the next character seems > like a bug, […] Indeed, but not a bug in ext/mbstring, but rather in Firefox (and maybe other browsers/renderers). It's displayed as expected in Chrome. Previous Comments: ------------------------------------------------------------------------ [2019-01-30 14:27:45] goncalomm at protonmail dot com You can fix this creating a simple function of turkish chars if you need to use this in 7.3 version. <?php $var = "MOZAİK"; function TurkishFix($inputText) { $search = array('ç', 'Ç', 'ğ', 'Ğ', 'ı', 'İ', 'ö', 'Ö', 'ş', 'Ş', 'ü', 'Ü'); $replace = array('c', 'C', 'g', 'G', 'i', 'I', 'o', 'O', 's', 'S', 'u', 'U'); $outputText=str_replace($search, $replace, $inputText); return $outputText; } $string = TurkishFix($var); echo mb_strtolower($string); Check here : https://3v4l.org/sYr8m ------------------------------------------------------------------------ [2018-12-30 16:41:26] nikic@php.net We're following what Unicode specifies here. Excerpt from SpecialCasing: # Preserve canonical equivalence for I with dot. Turkic is handled below. 0130; 0069 0307; 0130; 0130; # LATIN CAPITAL LETTER I WITH DOT ABOVE 0069 0307 is an "i" followed by "combining dot above". The fact that the dot is rendered over the next character seems like a bug, as combining marks generally apply to the previous character. Not sure what to do here, I can definitely see how the current behavior is unwanted if you're working with Turkish text and I'm not sure why it's specified to behave the way it does. ------------------------------------------------------------------------ [2018-12-30 16:21:43] sjon at hortensius dot net Description: ------------ I found this while going through https://3v4l.org/bughunt/7.3.0/7.2.13+7.2.12 it seems special characters are carried over to the next character when using mb_strtolower Test script: --------------- See https://3v4l.org/7pP2v and the scripts that it's based on echo mb_strtolower("MOZAİK"); Expected result: ---------------- mozaik Actual result: -------------- mozai̇k ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77375&edit=1

« previous php.bugs (#233214) next »