Title: [Plugin: dbview] Charset encoding (encodeHtmlEntities) is broken by using UTF-8
Last modified: August 20, 2016

---

# [Plugin: dbview] Charset encoding (encodeHtmlEntities) is broken by using UTF-8

 *  Resolved [AleksCee](https://wordpress.org/support/users/alekscee/)
 * (@alekscee)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/)
 * I have installed a fresh new test-WordPress and if I query a SQL like this:
 * select * from wp_posts
 * I only get the first “Wellcome”-Post from the german WP-Instaltion. The Umlauts
   are all broken and the Post is end with the first “-” in the Post.
    I have try
   to find out where the code goes broken… And I found this:
 *  if ($this->encodeHtmlEntities)
    { $dval = htmlentities($dval); }
 * in “DBViewTable.class.php” at line 153.
 * If I set the Calls-Attribut: public $encodeHtmlEntities = false
    all seams to
   by fine.
 * So I take a look at the PHP-Doc and found this:
    “If omitted, the default value
   for this argument is ISO-8859-1 in versions of PHP prior to 5.4.0”
 * So I set the Calls Attribut back to true and change this:
 * $dval = htmlentities($dval, ENT_COMPAT, get_option(‘blog_charset’));
 * Now it’s work fine…. can you take this into account.
 * [http://wordpress.org/extend/plugins/dbview/](http://wordpress.org/extend/plugins/dbview/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [john ackers](https://wordpress.org/support/users/john-ackers/)
 * (@john-ackers)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676812)
 * Aleks, thanks for reporting the issue and solving it! I will look at this tomorrow
   and correct plugin.
 *  Plugin Author [john ackers](https://wordpress.org/support/users/john-ackers/)
 * (@john-ackers)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676859)
 * Aleks
 * Having looked into this more closely, in particular, [this very helpful article](http://www.phpwact.org/php/i18n/charsets),
   it looks like I shouldn’t be doing any encoding/decoding for individual HTML 
   elements. Only the special HTML characters like <, & and > etc need to be handled.
 * So I am about to commit a new version that removes htmentities() and instead 
   uses esc_textarea(), a WP function used by many plugins. It works for umlauts
   and the string ‘Iñtërnâtiônàlizætiøn’. But the test is meaningless as I am using
   the default WP charset UTF-8. Can you tell me what character encoding you are
   using, so I can be sure that this fix works for you as well as me.
 * By the way, esc_textarea() calls htmlspecialchars() which according to the article
   above, should also be passed the blog_charset, in the same way as you suggest
   above. But if you don’t have problems with WP core or any other plugins, you 
   shouldn’t have any problems with the updated dbview.
 * John
 *  Plugin Author [john ackers](https://wordpress.org/support/users/john-ackers/)
 * (@john-ackers)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676860)
 * Actually re-reading the title of your article makes it clear u r using UTF-8 !
 *  Thread Starter [AleksCee](https://wordpress.org/support/users/alekscee/)
 * (@alekscee)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676886)
 * Hi,
 * I’ve updated the plugin and it now works correctly for me.
 * Thanks!
 * Alex
 *  Plugin Author [john ackers](https://wordpress.org/support/users/john-ackers/)
 * (@john-ackers)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676887)
 * Phew. Thanks Alex for the update.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘[Plugin: dbview] Charset encoding (encodeHtmlEntities) is broken by using
UTF-8’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/dbview.svg)
 * [dbview](https://wordpress.org/plugins/dbview/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dbview/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dbview/)
 * [Active Topics](https://wordpress.org/support/plugin/dbview/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dbview/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dbview/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [john ackers](https://wordpress.org/support/users/john-ackers/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-dbview-charset-encoding-encodehtmlentities-is-broken-by-using-utf-8/#post-2676887)
 * Status: resolved