How to Fix WordPress Charset Issues After Migration (Strange Symbols, Broken Characters)

0 1 year ago

After migrating your WordPress site, are you seeing weird characters like ’, é, Â, or instead of normal punctuation or language-specific letters?

These are signs of a character set (charset) mismatch, usually caused during the database export/import process. But the good news is — it’s fixable!

In this guide, you’ll learn why it happens and how to fix charset issues in WordPress after migration.


🧠 What Causes Charset Issues in WordPress?

When migrating a WordPress site between servers (especially with different MySQL versions), you may face:

  • Wrong character encoding in the database
  • Collation differences (latin1 vs utf8mb4)
  • Incorrect charset in wp-config.php
  • Broken data due to a bad import process

🧪 Symptoms You Might Notice

  • Apostrophes appear as ’ or ’
  • Foreign language characters appear broken
  • Emojis disappear or render as question marks
  • Posts and pages display gibberish symbols

✅ Step-by-Step: How to Fix Charset Problems in WordPress


🔹 Step 1: Check Your wp-config.php Charset

Login to your server and open:

nano /path-to-wordpress/wp-config.php

Make sure these lines look like:

define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', '');

If it’s set to latin1, change it to utf8mb4.


🔹 Step 2: Check Database Table Charset

Use phpMyAdmin or CLI to inspect the table charset:

In phpMyAdmin:

  1. Select your database
  2. Click on any table
  3. Look at the Collation column

You’ll likely see a mix of:

  • latin1_swedish_ci
  • utf8_general_ci
  • utf8mb4_unicode_ci

For full compatibility, all should be utf8mb4_unicode_ci (or similar).


If your tables are still latin1, you can convert them.

In phpMyAdmin, run this SQL for each table:

ALTER TABLE wp_posts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Repeat for:

  • wp_comments
  • wp_options
  • wp_users
  • Or use a script to apply this to all tables

Tip: Always backup your database before running ALTER queries.


🔹 Step 4: Use WP-CLI to Search & Replace Garbage Characters

If broken characters were already stored (e.g., during migration), use WP-CLI:

wp search-replace 'é' 'é' --all-tables
wp search-replace '’' '’' --all-tables

This corrects corrupted characters stored during bad encoding.


🔹 Step 5: Fix Your Export Process for Future Migrations

If you’re still migrating:

Use this when exporting from MySQL 8+:

mysqldump --default-character-set=utf8mb4 --skip-comments --column-statistics=0 --set-gtid-purged=OFF --no-tablespaces -u root -p your_db > your_backup.sql

Then import using:

mysql --default-character-set=utf8mb4 -u user -p your_db < your_backup.sql

This avoids collation/charset mismatch errors.


✅ Bonus Tips

  • ✅ Avoid using latin1 on any modern WordPress site
  • ✅ Use utf8mb4 to fully support emojis, multilingual content, and special symbols
  • ✅ Tools like Better Search Replace or WP Migrate DB can help detect charset issues
  • ✅ Use phpMyAdmin > Export > UTF8MB4 when exporting via the UI

📌 Summary: Fixing WordPress Charset Issues After Migration

ProblemFix
Weird characters (é, ’)Set utf8mb4 in wp-config.php
Collation mismatch in tablesConvert tables to utf8mb4_unicode_ci
Data already corruptedUse WP-CLI search-replace to fix
Future migrationsAlways export/import with --default-character-set=utf8mb4

⚡ Need Help Fixing a Broken WordPress Migration?

👉 Open a support request with Servers9
We’ll help you clean up corrupted content, restore the correct charset, and safely migrate your database without data loss.