Viewing 15 replies - 1 through 15 (of 16 total)
  • I use Japanese character.
    I updated WPP to 2.1.3 from 2.1.0, and my widget is garbled, too.
    It works properly with 2.1.0.

    I replaced $instance['title'] = htmlspecialchars( stripslashes(strip_tags( $new_instance['title'] )), ENT_QUOTES ); with $instance['title'] = htmlspecialchars( stripslashes(strip_tags( $new_instance['title'] )), ENT_QUOTES, 'UTF-8', FALSE );, but a problem was not settled.

    Same here for Russian language, instead of the post titles in Russian i get the same thing as yanc1985. The last proper working version was 2.1.0. I know for sure that the problem is somewhere in wordpress-popular-posts.php, but i can’t find it. Great plugin though, thanks

    Thanks Kirijun!

    After I read the Changelog for that Plugin I found the following comment in version 2.1.1: “Added htmlentities to post titles”.

    So the solution for correct implementation of htmlentities in WP is to give it the used charset, too (like Kirijun wrote).

    htmlentities is used two times in wordpress-popular-posts.php (v2.1.3): line 624 and line 630.
    The best way would be:

    1. Define the blog charset in wordpress-popular-posts.php
      Maybe before the first htmlentities occures.
      $bcharset = get_bloginfo('charset');
    2. Change line 624 to
      $title_attr = htmlentities($tit, ENT_QUOTES, $bcharset, FALSE);
    3. Change line 630 to
      $tit = htmlentities($tit, ENT_QUOTES, $bcharset, FALSE);

    @héctor Cabrera (the Plugin Author):
    Please fix that ASAP! – Thanks!

    sofar|sokai

    Hi guys,

    Please try this fix and let me know the results:

    1. Open wordpress-popular-posts.php using an editor such as Windows’ Notepad or Adobe Dreamweaver.
    2. 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');
    3. Save changes.

    P.S.: Sokai’s proposal seems a bit better. Will test this and post back later with new instructions.

    OK guys, please download 2.1.4 here and let me know if it fixes the issue.

    I downloaded 2.1.4 and it works correctly. Thank you!

    Good to know that, Kirijun! Thanks for reporting!

    Hi Ikki24.

    Thank you for fast reply.
    But there is still a little bug.

    It shows backslash like this in source code.

    <span class=\"wpp-post-title\">

    Hi mono-lab,

    Can you please post a screenshot of your WPP widget settings?

    Ok plese take a look in here.

    Thanks! Found the bug and fixed it, please download WPP 2.1.4 here and let me know if the issue is fixed.

    Latest 2.1.4 works fine for me with the german characters now. Thank you ikki24

    Thank you Ikki24.
    It works fine now!

    Thread Starter yanc1985

    (@yanc1985)

    Thanks for the quick reply and improvement ??

    Thank you guys for your continuous feedback and suggestions!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: WordPress Popular Posts] not support chinese character in sidebar widget?’ is closed to new replies.