mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-05 15:10:04 +00:00
Make guessEncodingBom Public
It can be used elsewhere.
This commit is contained in:
@@ -643,10 +643,10 @@ class Csv extends BaseReader
|
||||
}
|
||||
}
|
||||
|
||||
private static function guessEncodingBom(string $filename): string
|
||||
public static function guessEncodingBom(string $filename, ?string $convertString = null): string
|
||||
{
|
||||
$encoding = '';
|
||||
$first4 = file_get_contents($filename, false, null, 0, 4);
|
||||
$first4 = $convertString ?? file_get_contents($filename, false, null, 0, 4);
|
||||
if ($first4 !== false) {
|
||||
self::guessEncodingTestBom($encoding, $first4, self::UTF8_BOM, 'UTF-8');
|
||||
self::guessEncodingTestBom($encoding, $first4, self::UTF16BE_BOM, 'UTF-16BE');
|
||||
|
||||
Reference in New Issue
Block a user