Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Table counts wrong number of padding symbols inrenderCell() method when cell contain unicode variant selector#60042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vladimir-vv wants to merge2 commits intosymfony:6.4
base:6.4
Choose a base branch
Loading
fromvladimir-vv:fix_60038

Conversation

vladimir-vv
Copy link

@vladimir-vvvladimir-vv commentedMar 26, 2025
edited by OskarStark
Loading

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#60038
LicenseMIT

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

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.3 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot
Copy link

Hey!

Oh no, it looks like you have made this PR towards a branch that is not maintained anymore. :/
Could you update thePR base branch to target one of these branches instead? 6.4, 7.2, 7.3.

Cheers!

Carsonbot

@vladimir-vvvladimir-vv changed the base branch from5.4 to6.4March 26, 2025 08:11
@fabpot
Copy link
Member

@vladimir-vv Can you add some unit tests that would cover this fix?

@OskarStarkOskarStark changed the titleissues/60038: Table counts wrong number of padding symbols in method …[Console] Table counts wrong number of padding symbols in method renderCell(..) when cell contain unicode variant selectorMar 28, 2025
@vladimir-vv
Copy link
Author

vladimir-vv commentedApr 1, 2025
edited
Loading

@vladimir-vv Can you add some unit tests that would cover this fix?

Ok.
The testcase has been added.

@xabbuh
Copy link
Member

@vladimir-vv Can you please rebase here to re-trigger the CI?

…renderCell(..) when cell contain unicode variant selector.
…renderCell(..) when cell contain unicode variant selector. With testcase.
@@ -565,7 +565,7 @@ private function renderCell(array $row, int $column, string $cellFormat): string

// str_pad won't work properly with multi-byte strings, we need to fix the padding
if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
$width += \strlen($cell) - mb_strwidth($cell, $encoding);
$width += \strlen($cell) - mb_strwidth($cell, $encoding) + substr_count($cell, "\xef\xb8\x8f") + substr_count($cell, "\xef\xb8\x8e");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What exactly does the unicode sequence\xef\xb8\x8e refer to?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These U+FE0F, U+FE0E selectors are used to display emoji with color or monochrome. As I can see usually the U+FE0E selector is skipped.
Example with snowflake:
U+2744❄e2 9d 84
U+2744❄e2 9d 84 ef b8 8e
U+2744❄️e2 9d 84 ef b8 8f

@OskarStarkOskarStark changed the title[Console] Table counts wrong number of padding symbols in method renderCell(..) when cell contain unicode variant selector[Console] Table counts wrong number of padding symbols inrenderCell() method when cell contain unicode variant selectorMay 5, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@xabbuhxabbuhxabbuh left review comments

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

@lyrixxlyrixxAwaiting requested review from lyrixx

@ycerutoycerutoAwaiting requested review from yceruto

@dunglasdunglasAwaiting requested review from dunglas

@OskarStarkOskarStarkAwaiting requested review from OskarStark

@jderussejderusseAwaiting requested review from jderusse

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@vladimir-vv@carsonbot@fabpot@xabbuh@OskarStark

[8]ページ先頭

©2009-2025 Movatter.jp