MDL-54853 weblib: Specify version and fixed encoding
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 9 Jun 2016 01:53:48 +0000 (09:53 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 9 Jun 2016 01:53:48 +0000 (09:53 +0800)
lib/weblib.php

index 1e24072..c86dc0e 100644 (file)
@@ -1320,9 +1320,8 @@ function format_text($text, $format = FORMAT_MOODLE, $options = null, $courseidd
     }
 
     if ($options['blanktarget']) {
     }
 
     if ($options['blanktarget']) {
-        $encoding = ini_get('default_charset') ? ini_get('default_charset') : 'utf-8';
         $domdoc = new DOMDocument();
         $domdoc = new DOMDocument();
-        $domdoc->loadHTML('<?xml encoding="' . $encoding . '" ?>' . $text);
+        $domdoc->loadHTML('<?xml version="1.0" encoding="UTF-8" ?>' . $text);
         foreach ($domdoc->getElementsByTagName('a') as $link) {
             if ($link->hasAttribute('target') && strpos($link->getAttribute('target'), '_blank') === false) {
                 continue;
         foreach ($domdoc->getElementsByTagName('a') as $link) {
             if ($link->hasAttribute('target') && strpos($link->getAttribute('target'), '_blank') === false) {
                 continue;