Blog

  • Fixing Special Characters

    Posted at 30 Jun, 2018 in Solutions

    Sometimes your site looking corrupted and displays strange special characters. It will normally happen after you migrate your site from one server to another or after WordPress upgrade. It’s normally Database Charset issue. You can follow the instructions below in order to fix.

    Solution 1:

    Comment out the following lines in ‘wp-config.php’ which should fix the issue.

    /** Database Charset to use in creating database tables. */
    //define('DB_CHARSET', 'utf8');
    /** The Database Collate type. Don't change this if in doubt. */
    //define('DB_COLLATE', '');

    Solution 2:

    If the above change does not fix the issue, check whether any Cache Plugins installed in the site. If yes, clear the cache. There could be chances for conflicts if more than one Cache Plugin installed. You can disable one by one (don’t forget to check ‘.htaccess’ file whether the codes added by the Plugin were removed) and check.

    Solution 3:

    If nothing works, you can try the last solution (you should be very careful in performing this) – change the Database Charset from Latin to UTF-8 in the database. Follow the steps below in order to achieve this.

    • Export the MySQL database
    • Extract (if compressed) and open it in a Text Editor (have a backup of original file always)
    • Replace all occurences of CHARSET=latin1 with CHARSET=utf8
    • Replace all occurences of SET NAMES latin1 with SET NAMES utf8
    • Import the replaced database (Drop all the tables before if your SQL file did not have DROP TABLE added)
    • Uncomment the following line in ‘wp-config.php’ (if did as per Solution 1 above) – define('DB_CHARSET', 'utf8');

    This should fix the strange special characters issue in your site, else you need to manually replace all the characters 🙂

Categories

Categories

Archives

Archives