Skip to content

Commit

Permalink
Excel: Include Noncharacters from Above BOM
Browse files Browse the repository at this point in the history
  • Loading branch information
kergomard committed Nov 11, 2024
1 parent 333da2a commit 4fcfa83
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions Services/Excel/classes/class.ilExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,26 @@ class ilExcel
public const FORMAT_BIFF = "Xls";
protected string $format;

private string $noncharacters = '[\uFFFE-\uFFFF\uFDD0-\uFDEF]';
private array $noncharacters = [
'\x{FFFE}-\x{FFFF}',
'\x{1FFFE}-\x{1FFFF}',
'\x{2FFFE}-\x{2FFFF}',
'\x{3FFFE}-\x{3FFFF}',
'\x{4FFFE}-\x{4FFFF}',
'\x{5FFFE}-\x{5FFFF}',
'\x{6FFFE}-\x{6FFFF}',
'\x{7FFFE}-\x{7FFFF}',
'\x{8FFFE}-\x{8FFFF}',
'\x{9FFFE}-\x{9FFFF}',
'\x{AFFFE}-\x{AFFFF}',
'\x{BFFFE}-\x{BFFFF}',
'\x{CFFFE}-\x{CFFFF}',
'\x{DFFFE}-\x{DFFFF}',
'\x{EFFFE}-\x{EFFFF}',
'\x{FFFFE}-\x{FFFFF}',
'\x{10FFFE}-\x{10FFFF}',
'\x{FDD0}-\x{FDEF}'
];

protected ilLanguage $lng;
protected Spreadsheet $workbook;
Expand Down Expand Up @@ -570,6 +589,6 @@ public function mergeCells(string $coordinatesRange): void

private function cleanupNonCharachters(string $string): string
{
return mb_ereg_replace($this->noncharacters, '', $string);
return mb_ereg_replace('[' . implode('', $this->noncharacters) . ']', '', $string);
}
}

0 comments on commit 4fcfa83

Please sign in to comment.