Character issue in WordPress site

I have a problem with a WordPress site (it’s in Swedish). For some reason I can’t use all characters when I’m writing posts – the characters Ã¥, ä and ö become Ã¥ ä ö. The site is a webshop and I have the Woocommerce plugin installed. The same problem with åäö occurs in the long product descriptions of Woocommerce.

Anyone know what I can do to solve this? The character encoding in WordPress admin panel is set to UTF-8 and so is the database charset in wp-config.

Read More

In the database in phpmyadmin the collation of the wp-posts tables are set to “utf8_general_ci”. Is that the problem?

This thing has never happened to me before, even though I have built a lot of WP sites in the past. Therefore I don’t know what to do. Maybe the solution is simple but I want to know what I’m doing before doing anything so I don’t risk messing up the site.

Would really appreciate some help with this, thanks.

Related posts

Leave a Reply

3 comments

  1. When “national special characters”, ie. non-ASCII characters, are displayed wrong, you probably have an error related to charset. The easiest way to fix this is usually to make sure that you are using UTF-8 everywhere.

    (For Swedish in particular, you can use ISO-8859-1 (worst), ISO-8859-15 (better) or UTF-8 (best).)

    You need to use the same charset everywhere, from the database to the HTML declaration.

    1. In your theme’s header.php file, please make sure that the declared charset is
      UTF-8.
    2. In your text editor or on your server, please make sure your theme files are being saved as UTF-8.
    3. In MySQL, please make sure that the table schema is set to use utf-8.
    4. In MySQL, please make sure that connections default to use UTf-8: mysql --default-character-set=utf8
    5. In PHP, try setting the connection to utf-8 with mysqli_set_charset
  2. In order to fix the Character Encoding Mismatch Problem in WordPress,
    Open the ‘wp-config.php’ file in a text editor(the wp-config.php file can be found on the directory where you installed WordPress).
    Find the following two lines and comment them out:

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

    They should look like the following after you comment them out:

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

    Now upload the updated ‘wp-config.php’ file to your webhost.

    This character encoding problem can happen after a database upgrade too so it doesn’t hurt to keep this trick in your mind just in case.

  3. In another case, if you are using PHP Dom (loadHTML) somewhere, there is a need to load HTML as UTF-8. I have fixed it by:

    Replacing

    @$dom->loadHTML($html);
    

    to

    @$dom->loadHTML('<?xml encoding="UTF-8">' . $html);