Accents turning into strange symbols on your site: UTF-8 from file to database

The short answer: “ação” shows as “ação”, or as “a��o”, or as “a?o”. It is always the same problem: the text was written in one alphabet (encoding) and read in another. The fix is to make the file, the page, PHP and the database all speak UTF-8. You find where it fails, in order.

What each symptom points to

What you see Likely cause
“çã” (extra letters, starting with Ã) UTF-8 text read as if it were another alphabet (Latin-1). The page or the connection is not saying it is UTF-8.
“�” (a diamond with a question mark) Text in another alphabet read as UTF-8. The file was saved as ANSI/Latin-1.
“?” in place of the letter The letter was lost when saved to the database: the table or the connection cannot hold accents.
Only in e-mails or only in a PDF The message header or the PDF’s font, not the site.
After importing a database The imported file was read with the wrong alphabet.

Finding where it fails, in order

1 Look at the page: the HTML head should have <meta charset="utf-8"> right at the start.
2 Look at the file: open it in an editor that shows the encoding and save it as UTF-8 (without BOM). Many errors come from files saved as ANSI.
3 Look at PHP: the default_charset setting should be UTF-8: Viewing and adjusting your PHP configuration.
4 Look at the database: the tables and columns should use utf8mb4, and the site’s connection too. In WordPress, wp-config.php has define( 'DB_CHARSET', 'utf8mb4' );.
5 When importing, choose the file’s character set in phpMyAdmin: Importing a database.
Take a backup before converting anything, and do not convert the database without knowing what the problem is: converting twice writes double the strange symbols and is hard to undo. First find out whether the error is in reading (fixed without touching the data) or in saving.
If the data was already saved with the strange symbols, some can be fixed with a replacement in the database: Replacing text in the database. For spreadsheets with accents, see Product CSV.

Tried this and the symbols are still there? Open a ticket with the address and an example of the text.

Open a support ticket

SEE ALSO

Viewing and adjusting your PHP configuration: version per folder, extensions and phpinfo

Importing a database with phpMyAdmin, and the size limit that stops you

Exporting a database with phpMyAdmin

Replacing old addresses in a WordPress database without breaking it

Importing and exporting products in WooCommerce with a CSV file

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?