≡ Menu

How to get rid of â, ’,Â, ¢ weird characters from showing up on WordPress posts after SQL Database import

Recently, I imported a database for WordPress which left me with a few weird characters like â ’  ¢ for apostrophes, and spaces on my posts, pages, and comments on my WP blog. If you have very few posts like 5 or less short posts, you can search for â, ’, and  with the default WordPress post, pages, and comment search engine in the dashboard and manually remove them with the WordPress Post editor.

But, if you have a lot of posts, you can uncomment the define(‘DB_CHARSET’, ‘utf8’); and define(‘DB_COLLATE’, ”); in the WP-config.php file which you can find at the root of the WordPress folder.

You need to use two back // backslashes to uncomment the two lines in wp-config.php. Be sure to back up your WP-config.php file before you make changes to it.

Now the two lines I mention should look like

//define(‘DB_CHARSET’, ‘utf8’);
//define(‘DB_COLLATE’, ”);

in your WP-config.php file.

Now Upload your new WP-config.php file to overwrite your old one.

Once you are done you should use the post search engine to search for â, ’, and  to see if they are still in your post, pages, and comments which they shouldn’t be in after you made the changes to your WP-config.php file.

I notice after I uncommented

define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);

there were weird diamond characters with a question mark in the center like � in some of your posts, so you should also search for the � character and any out of place characters to remove from your post, pages, and comments if any exists.

I wonder if this weird character also happen when you upload the XML file of all your posts, Comments,  etc for WordPress, or if it just happen when you import a database via Phpmyadmin or SSH.

One of the advantages of HTML websites vs Database driven blogs and CMS sites is it will usually look the same as it does on your computer, WYSIWYG editor like Frontpage, or notepad after you upload the HTML files to your server in my experience, and there are no weird characters on the posts as long as you are using a modern browser like IE9, Firefox, Opera, or Chrome.  But, with database sites, you may encounter weird characters if your SQL file, Phpmyadmin, or CMS are not set up right to display the characters properly.

0 comments… add one

Leave a Comment