WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
Bug with text truncation for multibyte characters (3 posts)

  1. Rick Radko
    Member
    Posted 2 years ago #

    Héctor,

    The truncate function uses substr (in 3 places) to truncate the text for display. substr is not multibyte character compatible. If you happen to have an accented or other multibyte character that should be the last character of the truncated string, it gets cut apart by substr and shows as a weird character. Replacing substr with mb_substr (which is multibyte aware) fixes the issue.

    http://wordpress.org/extend/plugins/wordpress-popular-posts/

  2. Héctor Cabrera
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks mate for spotting this one! Already made the changes on WPP, will push an update soon.

  3. Rick Radko
    Member
    Posted 2 years ago #

    Hey, it found me! What are the odds of one of the first posts, on the first site I used the plugin on, having a multi-byte character fall at 100 bytes? (my first temporary fix for the site was to change the trim length to 105 characters...)

    Thanks for fixing, and looking forward to the next release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic