MacMacken
Member
Posted 1 year ago #
WordPress Popular Posts fails to correctly encode special characters, the problem has I occured since I updated to version 2.1.3.
Screenshot:
http://macmacken.com/wp-content/uploads/2010/07/wpp_20100714_001.png
Martin
http://wordpress.org/extend/plugins/wordpress-popular-posts/
Hi Martin,
Please follow these instructions and let me know if it fixes the issue:
- Open wordpress-popular-posts.php using an editor such as Windows' Notepad or Adobe Dreamweaver.
- Around line 622, find and change this:
$tit = stripslashes($tit);
$title_attr = htmlentities($tit, ENT_QUOTES);
if ( $instance['shorten_title']['active'] && (strlen($tit) > $instance['shorten_title']['length'])) {
$tit = mb_substr($tit, 0, $instance['shorten_title']['length'], 'UTF-8') . "...";
}
$tit = htmlentities($tit, ENT_QUOTES);
... into this:
$tit = stripslashes($tit);
$title_attr = htmlentities($tit, ENT_QUOTES, 'UTF-8');
if ( $instance['shorten_title']['active'] && (strlen($tit) > $instance['shorten_title']['length'])) {
$tit = mb_substr($tit, 0, $instance['shorten_title']['length'], 'UTF-8') . "...";
}
$tit = htmlentities($tit, ENT_QUOTES, 'UTF-8');
- Save changes.
MacMacken
Member
Posted 1 year ago #
Thank you, Ikki24, the suggested UTF-8 amendment of wordpress-popular-posts.php fixed the issue.
WordPress Popular Posts 2.1.4 will detect automatically the charset used on your blogs so you won't have to change it manually. Will release it within the next couple of days, so stay tuned!
MacMacken
Member
Posted 1 year ago #
Thanks again, I have just upgraded to version 2.1.4 and the problem is definitely no longer reproducible. Great job, thank you!