Skip to content

Commit d16407b

Browse files
committed
Make guessEncodingBom Public
It can be used elsewhere.
1 parent f981ef9 commit d16407b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PhpSpreadsheet/Reader/Csv.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,10 @@ private static function guessEncodingTestBom(string &$encoding, string $first4,
643643
}
644644
}
645645

646-
private static function guessEncodingBom(string $filename): string
646+
public static function guessEncodingBom(string $filename, ?string $convertString = null): string
647647
{
648648
$encoding = '';
649-
$first4 = file_get_contents($filename, false, null, 0, 4);
649+
$first4 = $convertString ?? file_get_contents($filename, false, null, 0, 4);
650650
if ($first4 !== false) {
651651
self::guessEncodingTestBom($encoding, $first4, self::UTF8_BOM, 'UTF-8');
652652
self::guessEncodingTestBom($encoding, $first4, self::UTF16BE_BOM, 'UTF-16BE');

0 commit comments

Comments
 (0)