In this article, We will see how we can fix the character encoding issue or strange characters appearing on posts content in WordPress websites.
Recently I changed the theme of one of my websites. It was cool, way better looking than the previous one and the speed improved a lot. However, there was an issue that I didn’t see for more than 2-3 days. Once I noted it, I searched all over the internet to fix it. Finally, I got a fix for the problem. The problem that I was facing was, On my website, characters like these (â?€) were showing up everywhere in blog content and title.
These were the odd characters appearing all over the website content and title: “â?€”. In this article, We will see how we can fix this strange character issue or character encoding issue on the WordPress website. Let’s start.
How To Fix Characters Encoding Issue | Remove Strange Characters Issue on WordPress Website 2020
1. First of all, Open the cpanel or else open your directory through any FTP (ex. FileZilla)
2. Now Open the “wp-config.php” file in a text editor such as notepad (the wp-config.php file can be found on the directory where your WordPress is installed).
3. Find these two lines and comment them out:
define('DB_CHARSET', 'utf8'); define('DB_COLLATE', '');
After commenting it, It would like like below:
4. Now upload the new ‘wp-config.php’ file (overwriting the old one).
That’s it. Hope this method works for you. My problem just got resolved using this method. In case, if it didn’t fix your issue then I am posting all the possible solutions for this odd character encoding issue in wordpress.
Why this strange character encoding problem occurs?
- This character encoding problem can occur after changing the server or by a database upgrade or just by changing the theme. You can use the above method 1 to fix it. However, if didn’t solve your problem then see other methods I am posting below.
- This character encoding problem can also be caused when you are copying or pasting some MS Word information into the WordPress content editor. WordPress uses something called “Smart Quotes”, via a function named wptexturize.
Method 2: If you are copy/pasting then the ideal solution would be to go back through all of your content, and replace all single/double quotes using the keyboard.
However, if you’re working with massive copy/pastes from other sources then this may not be possible. Take a look at method 3.
Method 3: You can use the plugin wptexturize and check whether this plugin fixes your issue or not.
Method 4: The issue can be caused by the plugins. So just deactivate plugin one by one and check if the issue was due to some plugin or you can delete the plugin folder directly from your FTP and check if the problem is fixed or not. And here’s what you should do next, re-install the plugin through the WordPress admin panel.
Method 5: Check your wp_config.php file. Open it with a text editor. Find the below lines:
and change it to:
upload and see if that works for you.
Method 6: try the below method
* Create a new post.
* Use the ‘visual’ editor.
* End your first sentence with a period (.) followed by two spaces.
* Begin and end another sentence.
If your character encoding on your browser is set to Unicode (UTF-8) you will see the two spaces after the period, but if you change it to Western (ISO-8859-1) you will see the funny A character (Â).
The funny A character makes it into the ‘post_content’ variable and into the DB; I have a custom plug-in I use to notify customers of new posts and the funny A gets sent out in those messages too.
Note: if you re-save your post, the funny A character goes away in your published post.
Method 7: Use plugin “Search and Replace” and replace those strange characters.
- First of all, install the plugin by searching the plugin name or directly download from above link and upload it.
- After installing it, Go to the plugin dashboard by going into ‘Tools’ and then to ‘search and replace’.
- Now In the “Search for”, put all those strange characters and leave the “Replace with” with blank.
- Save it and check if the issue if all those characters is replaced or not.
Note: If you search your content for these characters
â€˜ â � you will not find them, because they are not there. Characters
â€˜ â � like these are a sign, that the character encoding in the frontend does not match with that from the database. Normaly wordpress used for database, file endcoding and character encoding UTF-8.
That’s it. Hope this works for you. Try all the method one by one if the previous didn’t work. In case, none of the method work then you can ask your query in the comment section below. I will try to help you as soon as possible.
Tags: Fix strange character issue in wordpress website, solve odd characters problem utf8, fix strange character encoding issue in wordpress website posts content and title