php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67276 mb_strwidth count combining chars
Submitted: 2014-05-14 13:41 UTC Modified: 2018-03-11 14:41 UTC
From: nicolas dot grekas+php at gmail dot com Assigned:
Status: Open Package: mbstring related
PHP Version: 5.5.12 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-05-14 13:41 UTC] nicolas dot grekas+php at gmail dot com
Description:
------------
combining characters should account for zero width when counted with mb_strwidth.

Test script:
---------------
<?php

$a = 'é';

echo mb_strwidth($a, 'utf8'), "\n";

$b = Normalizer::normalize($a, Normalizer::NFD);

echo mb_strwidth($b, 'utf8'), "\n";


Expected result:
----------------
1
1

Actual result:
--------------
1
2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-11 14:41 UTC] cmb@php.net
Not sure if this is a bug or rather a feature request.  Anyhow, I
guess it won't be fixed, since mbfl has no notion of combining
characters, generally, and the grapheme_*() functions already
cater to that.  Furthermore, mb_strwidth() appears to be useful
for monospaced fonts only.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Sep 28 08:01:25 2020 UTC