Hi Luke,
Thanks for posting your issue. I will try to fix it asap.
Best regards,
Bass
Hi Luke,
line 580 of the plugin is now:
echo utf8_decode($doc->saveXML($image)); break;
I expect utf8_decode() here cause your problem.
I you want to test this, replace this line with:
echo $doc->saveXML($image); break;
This decoding don’t seems to make sense at all. I will test this and remove it in the next version.
Thanks and best regards,
Bass
Hi Bass,
I downloaded update. But it still doesn’t work right.
If you can tested on my site. Write me at skype lukas.pavel1
Luke
Thanks for your help
Hi Luke,
Yes, sorry i see. I expected DOMDocument utf-8 encoded by default, but it is not for some reason.
Please replace line 572 – 580 with:
$doc = new DOMDocument();
$doc->loadHTML('<?xml encoding="'.DB_CHARSET.'">' . $thumbnail );
$images = $doc->getElementsByTagName('img');
foreach ($images as $image) {
$image->setAttribute('class',$image->getAttribute('class').' img-responsive');
$image->removeAttribute('height');
$image->removeAttribute('width');
//see: http://stackoverflow.com/questions/6321481/printing-out-html-content-from-domelement-using-nodevalue
echo $doc->saveXML($image); break;
I’m still having this issue.
In category template :
/wp-content/uploads/2014/05/Comptoir-T-modifié-300×225.jpg
Whereas it’s working fine in single product template :
/wp-content/uploads/2014/05/Comptoir-T-modifié-360×270.jpg
Do you know what’s wrong ?
Thanks for your help !
Hi @bgouban,
Thank for posting your issue.
Since this issues pops up again i think changing the thumbnail HTML code within a DOMDocument is not a good idea at all.
I will consider this code in the next version.
For now as i understand WordPress defines the encoding twice.
The encoding for the database in wp-config.php with define(‘DB_CHARSET’, ‘utf8’);
And secondly the HTML encoding, as i understand you can change this value since version 3.5 (http://codex.ww.wp.xz.cn/Function_Reference/bloginfo) and is UTF-8 always.
So i expected your DB_CHARSET is not utf-8 (or the data in your database is not encoded utf-8).
So echo $doc->saveXML($image); break; on line 609 prints the wrong encoding.
Are you enable to test changing this line into the following code:
echo iconv('UTF-8',DB_CHARSET,$doc->saveXML($image)); break;