Title: Character Encoding Issue
Last modified: August 21, 2016

---

# Character Encoding Issue

 *  Resolved [bitlost](https://wordpress.org/support/users/bitlost/)
 * (@bitlost)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/character-encoding-issue-3/)
 * Found that the plugin was causing strange character encoding issues. To fix I
   added these two lines to function.php (websitez_filter_advanced_page function)
 * Here is the original code…
 *     ```
       /*
       Filter content for an advanced mobile device
       */
       function websitez_filter_advanced_page($html){
       	if (class_exists('DOMDocument')) {
       		try{
       			//Resize the images on the page
       			$dom = new DOMDocument();
       			$dom->loadHTML($html);
                               .....
       ```
   
 * Here is what I added
 *     ```
       /*
       Filter content for an advanced mobile device
       */
       function websitez_filter_advanced_page($html){
       	if (class_exists('DOMDocument')) {
       		try{
       			//Resize the images on the page
       			$html = mb_convert_encoding($html, 'utf-8', mb_detect_encoding($html));
       			$html = mb_convert_encoding($html, 'html-entities', 'utf-8');
   
       			$dom = new DOMDocument();
       			$dom->loadHTML($html);
                               ....
       ```
   
 * [http://wordpress.org/plugins/wp-mobile-detector/](http://wordpress.org/plugins/wp-mobile-detector/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [websitezcom](https://wordpress.org/support/users/websitezcom/)
 * (@websitezcom)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/character-encoding-issue-3/#post-4236632)
 * What type of encoding does your DB use? What encoding is being set inside your
   WP Admin? You might be able to set the encoding right on the $dom variable instead
   of converting. I will see if I can find anything related to this with the DOMDocument
   class.
 * I would hesitate in using this type of a fix because it can cause other issues.

Viewing 1 replies (of 1 total)

The topic ‘Character Encoding Issue’ is closed to new replies.

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

 * 1 reply
 * 2 participants
 * Last reply from: [websitezcom](https://wordpress.org/support/users/websitezcom/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/character-encoding-issue-3/#post-4236632)
 * Status: resolved