Skip to content

Commit 1719632

Browse files
Use mb_detect_encoding with $strict = true
1 parent 7c334a2 commit 1719632

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ private function stringWidth($string)
10891089
return strlen($string);
10901090
}
10911091

1092-
if (false === $encoding = mb_detect_encoding($string)) {
1092+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
10931093
return strlen($string);
10941094
}
10951095

@@ -1106,7 +1106,7 @@ private function splitStringByWidth($string, $width)
11061106
return str_split($string, $width);
11071107
}
11081108

1109-
if (false === $encoding = mb_detect_encoding($string)) {
1109+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
11101110
return str_split($string, $width);
11111111
}
11121112

Helper/Helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function strlen($string)
5353
return strlen($string);
5454
}
5555

56-
if (false === $encoding = mb_detect_encoding($string)) {
56+
if (false === $encoding = mb_detect_encoding($string, null, true)) {
5757
return strlen($string);
5858
}
5959

Helper/TableHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private function renderCell(array $row, $column, $cellFormat)
386386
$width = $this->getColumnWidth($column);
387387

388388
// str_pad won't work properly with multi-byte strings, we need to fix the padding
389-
if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell)) {
389+
if (function_exists('mb_strwidth') && false !== $encoding = mb_detect_encoding($cell, null, true)) {
390390
$width += strlen($cell) - mb_strwidth($cell, $encoding);
391391
}
392392

0 commit comments

Comments
 (0)