Support UTF-8 Table names
Added support for UTF-8 Table names (including combined character)
This commit is contained in:
parent
59083263e1
commit
8889ecf044
|
|
@ -103,10 +103,10 @@ class Table
|
||||||
) {
|
) {
|
||||||
throw new PhpSpreadsheetException('The table name can\'t be the same as a cell reference');
|
throw new PhpSpreadsheetException('The table name can\'t be the same as a cell reference');
|
||||||
}
|
}
|
||||||
if (!preg_match('/^[A-Z_\\\\]/i', $name)) {
|
if (!preg_match('/^[\p{L}_\\\\]/iu', $name)) {
|
||||||
throw new PhpSpreadsheetException('The table name must begin a name with a letter, an underscore character (_), or a backslash (\)');
|
throw new PhpSpreadsheetException('The table name must begin a name with a letter, an underscore character (_), or a backslash (\)');
|
||||||
}
|
}
|
||||||
if (!preg_match('/^[A-Z_\\\\][A-Z0-9\._]+$/i', $name)) {
|
if (!preg_match('/^[\p{L}_\\\\][\p{L}\p{M}0-9\._]+$/iu', $name)) {
|
||||||
throw new PhpSpreadsheetException('The table name contains invalid characters');
|
throw new PhpSpreadsheetException('The table name contains invalid characters');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,8 @@ class TableTest extends SetupTeardown
|
||||||
['_table_2', '_table_2'],
|
['_table_2', '_table_2'],
|
||||||
['\table_3', '\table_3'],
|
['\table_3', '\table_3'],
|
||||||
[" Table_4 \n", 'Table_4'],
|
[" Table_4 \n", 'Table_4'],
|
||||||
|
['table.5', 'table.5'],
|
||||||
|
['தமிழ்', 'தமிழ்'], // UTF-8 letters with combined character
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,6 +74,7 @@ class TableTest extends SetupTeardown
|
||||||
['R11C11'],
|
['R11C11'],
|
||||||
['123'],
|
['123'],
|
||||||
['=Table'],
|
['=Table'],
|
||||||
|
['ிக'], // starting with UTF-8 combined character
|
||||||
[bin2hex(random_bytes(255))], // random string with length greater than 255
|
[bin2hex(random_bytes(255))], // random string with length greater than 255
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue