Skip to content
Snippets Groups Projects
Commit d490cfc0 authored by Demian Katz's avatar Demian Katz
Browse files

Factored stripBadChars to its own function for reusability.

parent 0329f593
No related merge requests found
......@@ -214,6 +214,19 @@ class VuFind
return "{$cmd} -o {$output} -x {$input}";
}
/**
* Strip illegal XML characters from a string.
*
* @param string $in String to process
*
* @return string
*/
public static function stripBadChars($in)
{
$badChars = '/[^\\x0009\\x000A\\x000D\\x0020-\\xD7FF\\xE000-\\xFFFD]/';
return preg_replace($badChars, ' ', $in);
}
/**
* Harvest the contents of a document file (PDF, Word, etc.) using Aperture.
* This method will only work if Aperture is properly configured in the
......@@ -253,8 +266,7 @@ class VuFind
// Send back what we extracted, stripping out any illegal characters that
// will prevent XML from generating correctly:
$badChars = '/[^\\x0009\\x000A\\x000D\\x0020-\\xD7FF\\xE000-\\xFFFD]/';
return preg_replace($badChars, ' ', $final);
return static::stripBadChars($final);
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment