Merge pull request #1806 from drshawnkwang/drupal_fix-usermodlinks-utf8

Drupal: Added UTF-8 encoding for loadHTML.
This commit is contained in:
tristanolive 2017-03-09 12:04:14 -05:00 committed by GitHub
commit eb6d5e1b2f
1 changed files with 2 additions and 2 deletions

View File

@ -714,7 +714,7 @@ function _boinc_create_moderator_links(&$links, &$moderator_links) {
// Create an array of HTML elements from the $links string, keys
// are the class attribute for the <li> tags.
$dom = new DOMDocument;
$dom->loadHTML($links);
$dom->loadHTML(mb_convert_encoding($links, 'HTML-ENTITIES', 'UTF-8'));
foreach($dom->getElementsByTagName('li') as $node) {
$key = $node->getAttribute("class");
$alllinks[$key] = $dom->saveHTML($node);
@ -754,7 +754,7 @@ function _boinc_create_moderator_links(&$links, &$moderator_links) {
function _boinc_firstlink(&$alink) {
if (!empty($alink)) {
$dom = new DomDocument;
$dom->loadHTML($alink);
$dom->loadHTML(mb_convert_encoding($alink, 'HTML-ENTITIES', 'UTF-8'));
$myli = $dom->getElementsByTagName('li');
if ($myli->length>0) {