Skip to content

Commit

Permalink
This now captures all invalid XML chars
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparsd authored Oct 12, 2018
1 parent fdb170a commit 13c31ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/XmlToJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function parse( $xml_file ) {
protected function escape_xml( $xml ) {
// Remove all invalid characters per XML spec:
// @see https://www.w3.org/TR/xml11/#charsets
$xml = preg_replace( '/[^\x9\xA\xB\xD\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]/u', ' ', $xml );
$xml = preg_replace( '/[^\x9\xa\x20-\xD7FF\xE000-\xFFFD]/', ' ', $xml );

// Escape XML entities.
// @todo Prevent from touching the CDATA content.
Expand Down

0 comments on commit 13c31ef

Please sign in to comment.