Commit b74f2614 authored by Hamish Friedlander's avatar Hamish Friedlander

Make UTF-8 safe

parent ba1c916b
......@@ -225,15 +225,19 @@ class DocumentImportInnerField extends UploadField {
return $content;
// you need Tidy, i.e. port install php5-tidy
// Clean up with tidy (requires tidy module)
$tidy = new Tidy();
$tidy->parseString($content, array('output-xhtml' => true), 'utf8');
// Add a header that makes DOMDocument UTF-8 safe
$html = str_replace('<head>', '<head><meta http-equiv="content-type" content="text/html; charset=utf-8">', $tidy);
// Load in the HTML
$doc = new DOMDocument();
$doc->strictErrorChecking = false;
$doc->loadHTML('' . $tidy);
$xpath = new DOMXPath($doc);
Markdown is supported
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