Fix shared strings XML Entities auto decode (#411)
When converting an XMLReader node to a SimpleXMLElement, the conversion would automatically decode the XML entities. This resulted in a double decode. For example: """ was converted to """ when imported into a SimpleXMLElement and was again converted into " (quote). This commit changes the way the XLSX Shared Strings file is processed. It also changes the unescaping logic for both XLSX and ODS. Finally, it removes any usage of the SimpleXML library (yay!).
This commit is contained in:
1 parent
1eb01a3d2a
commit
048105461c
17 files changed
+120
-405
No files matched your search
@@ -421,7 +421,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->writeToODSFile($dataRows, $fileName);
|
||||
|
||||
$this->assertValueWasWritten($fileName, 'I'm in "great" mood', 'Quotes should be escaped');
|
||||
$this->assertValueWasWritten($fileName, 'I\'m in "great" mood', 'Quotes should not be escaped');
|
||||
$this->assertValueWasWritten($fileName, 'This <must> be escaped & tested', '<, > and & should be escaped');
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@ class WriterTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$this->writeToXLSXFile($dataRows, $fileName);
|
||||
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 'I'm in "great" mood', 'Quotes should be escaped');
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 'I\'m in "great" mood', 'Quotes should not be escaped');
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 'This <must> be escaped & tested', '<, > and & should be escaped');
|
||||
}
|
||||
|
||||
@@ -482,14 +482,14 @@ class WriterTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testAddRowShouldEscapeControlCharacters()
|
||||
{
|
||||
$fileName = 'test_add_row_should_escape_html_special_characters.xlsx';
|
||||
$fileName = 'test_add_row_should_escape_control_characters.xlsx';
|
||||
$dataRows = [
|
||||
['control\'s '.chr(21).' "character"'],
|
||||
['control '.chr(21).' character'],
|
||||
];
|
||||
|
||||
$this->writeToXLSXFile($dataRows, $fileName);
|
||||
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 'control's _x0015_ "character"');
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 'control _x0015_ character');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user