{"id":130,"date":"2014-02-10T14:20:25","date_gmt":"2014-02-10T21:20:25","guid":{"rendered":"http:\/\/www.planetcy.com\/?p=130"},"modified":"2014-02-10T14:20:25","modified_gmt":"2014-02-10T21:20:25","slug":"drupal-ldap-invalid-multibyte","status":"publish","type":"post","link":"http:\/\/www.planetcy.com\/?p=130","title":{"rendered":"Drupal LDAP invalid multibyte"},"content":{"rendered":"<p>After enabling the LDAP modules in Drupal 7 I was trying to test my config. Using the test function in the module it was returning the user information as expected along with several lines similar to this.<\/p>\n<p><code>Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1572 of \/var\/www\/drupal\/includes\/bootstrap.inc <\/code><\/p>\n<p>I found the following post:<\/p>\n<p><a title=\"https:\/\/drupal.org\/comment\/6647386#comment-6647386\" href=\"https:\/\/drupal.org\/comment\/6647386#comment-6647386\" target=\"_blank\">https:\/\/drupal.org\/comment\/6647386#comment-6647386<\/a><\/p>\n<p>And replaced the following code:<\/p>\n<p><code>function check_plain($text) {<br \/>\n return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');<br \/>\n}<br \/>\n<\/code><br \/>\nWith this:<br \/>\n<code>function check_plain($text) {<br \/>\n        if (!mb_detect_encoding($text, 'UTF-8', true)) {<br \/>\n                $text = mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');<br \/>\n                        }<br \/>\n  return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');<br \/>\n}<br \/>\n<\/code><\/p>\n<p>And the warning has gone away. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>After enabling the LDAP modules in Drupal 7 I was trying to test my config. Using the test function in the module it was returning the user information as expected along with several lines similar to this. Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1572 of \/var\/www\/drupal\/includes\/bootstrap.inc I found the following post: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[24,25],"class_list":["bg-stuff"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=130"}],"version-history":[{"count":7,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/posts\/130\/revisions"}],"predecessor-version":[{"id":150,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=\/wp\/v2\/posts\/130\/revisions\/150"}],"wp:attachment":[{"href":"http:\/\/www.planetcy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.planetcy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}