Jul 1 2008

How to work around the Warning: cannot yet handle MBCS in html_entity_decode()! error with WP-Postviews

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Searchmarked.com Tip

I don’t remember exactly where I found this little hack or I would have put the usual google query with a link to the source in this post. So whoever you are out there, thank you. I love the WP-Postviews plugin, but I found out after some Googling that it does not work with PHP 4 (only PHP 5). You will get the following error:

MBCS in html_entity_decode()!

Fortunately, if your site uses utf-8 encoding you can use the following one line hack to work around the PHP 4 incompatibility.

Make sure you make a backup of your wp-postviews.php file before you edit it.

-Open up wp-postviews.php in your favorite text editor.

-Look for the following line:

$text = html_entity_decode($text, ENT_QUOTES, get_option('blog_charset'));

-Replace the line with the following:

$text = utf8_decode($text);

That’s it! WP-Postviews should work perfectly now. It did for me at least ;) . Thanks for the awesome plugin Lester!

Technorati Tags: , , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

15 Comments on this post


  1. Fix for “Warning: cannot yet handle MBCS in html_entity_decode()! error” in WP-Postviews | James Reuben Knowles wrote:

    [...] To work around this problem, I found some great notes on SearchMarked.com. [...]

    January 15th, 2009 at 5:13 pm
  1. GaMerZ said:

    Thanks for the compliments =D

    July 2nd, 2008 at 2:18 am
  2. hstagner said:

    You are welcome! Thanks for stopping by and thanks for creating the awesome plugin.


    Harley Stagner

    July 2nd, 2008 at 2:53 am
  3. V said:

    This post was extremely helpful.

    Congratulations for your great blog!



    September 7th, 2008 at 3:51 pm
  4. Tacky News said:

    Thanks for this it fixed my problem! Host must still be using PHP4.

    September 19th, 2008 at 4:19 pm
  5. Metin said:

    I cant find solution anywhere but this is perfect :) thanks thanks thanks…

    September 24th, 2008 at 6:11 pm
  6. Abhilash said:

    Thans a lot hstagner. This worked perfectly.
    Very grateful

    October 25th, 2008 at 11:30 pm
  7. dlv said:

    wow, some second googling and i get your answer
    thanks so much, it’s work perfectly in my site
    thanks !

    October 26th, 2008 at 12:55 pm
  8. Dionisio Rearte said:

    Cool. It worked fine. Only one trouble: special characters (my blog is sp: á é í ó ú and ñ) do not print correctly, I’m working on it.
    Thanks for your hacker attitude.

    November 1st, 2008 at 12:37 pm
  9. Patrick said:

    Thanks for the resolution. It worked without upgrading to PHP5.

    November 1st, 2008 at 10:36 pm
  10. Tooksara said:

    Thank you so much. Hope I will don’t need to hack more :)

    June 11th, 2009 at 11:04 am
  11. Mozer said:

    THANK YOU SO MUCH! I used this on a Joomla site and it saved me tons of trouble.

    January 3rd, 2010 at 1:38 am
  12. Muhammad Fahd said:

    Thank you so much for this contribution

    February 4th, 2010 at 4:15 pm
  13. Arun said:

    Wow thanks u so much it work perfectly…

    February 23rd, 2010 at 10:09 am
  14. geoge said:
    July 28th, 2011 at 10:27 am


Subscribe Form

Subscribe to Blog


Recent Readers

                  Computers Blogs - Blog Top Sites