8000 [Console] Fix computing column width containing multibyte chars · symfony/symfony@f32179e · GitHub
[go: up one dir, main page]

Skip to content

Commit f32179e

Browse files
cay89nicolas-grekas
authored andcommitted
[Console] Fix computing column width containing multibyte chars
1 parent 2f62c4a commit f32179e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ private function calculateColumnsWidth(iterable $groups)
805805
$textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
806806
$textLength = Helper::width($textContent);
807807
if ($textLength > 0) {
808-
$contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
808+
$contentColumns = mb_str_split($textContent, ceil($textLength / $cell->getColspan()));
809809
foreach ($contentColumns as $position => $content) {
810810
$row[$i + $position] = $content;
811811
}

src/Symfony/Component/Console/Tests/Helper/TableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public function renderProvider()
316316
],
317317
new TableSeparator(),
318318
[
319-
new TableCell('Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil!', ['colspan' => 3]),
319+
new TableCell('Cupìdĭtâte díctá âtquè pôrrò, tèmpórà exercitátìónèm mòdí ânìmí núllà nèmò vèl níhìl!', ['colspan' => 3]),
320320
],
321321
],
322322
'default',
@@ -333,7 +333,7 @@ public function renderProvider()
333333
| 9971-5-0210-0 | A Tale of |
334334
| | Two Cities |
335335
+-------------------------------+-------------------------------+-----------------------------+
336-
| Cupiditate dicta atque porro, tempora exercitationem modi animi nulla nemo vel nihil! |
336+
| Cupìdĭtâte díctá âtquè pôrrò, tèmpórà exercitátìónèm mòdí ânìmí núllà nèmò vèl níhìl! |
337337
+-------------------------------+-------------------------------+-----------------------------+
338338

339339
TABLE

0 commit comments

Comments
 (0)
0