Skip to content

Symfony\Component\Console\Helper\Table counts wrong number of padding symbols in method renderCell(..) #60038

@vladimir-vv

Description

@vladimir-vv

Symfony version(s) affected

7.2

Description

When rendering a table in console and use emojis then width of columns could be wrong calculated.

How to reproduce

Use any emoji with variant selector (U+FE0F, U+FE0E) in cell output. For example ❄️

Possible Solution

Don't count number of variant selector symbols when counting padding for multi-byte strings.

private function renderCell(/* .. */): string  {
// ...
        if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
            $width += \strlen($cell) - mb_strwidth(str_replace(["\xef\xb8\x8f", "\xef\xb8\x8e", ], "", $cell), $encoding);
        }

Additional Context

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy