Strange symbols in accents and ñ (é, ñ, �): why they appear and how to fix them
If your site shows é instead of é, ñ instead of ñ, or the � symbol, your text isn’t damaged: it’s being read with a different encoding than the one it was saved with. The fix is almost always to make everything use UTF-8.
What the symbol tells you
é,ñ,¿: the text is saved as UTF-8 but displayed as ISO-8859-1 (Latin-1). Check step 1 and step 3.�or?: the text is saved as ISO-8859-1 and displayed as UTF-8. Check step 2.- Only content from the database breaks (posts, products, names), not the page’s fixed text: check step 3.
1. Declare UTF-8 in your HTML
Add this line as the first element inside <head>:
<meta charset="utf-8">
If your server sends a different encoding in its headers, the browser follows the server. To force UTF-8 across the whole site, add this line to your .htaccess file:
AddDefaultCharset UTF-8
WordPress, Joomla and Moodle already declare UTF-8; if you use one of them, go to step 3.
2. Save your files as UTF-8
If you edit files on your computer and then upload them, your editor has to save them as UTF-8:
- VS Code: click the encoding in the bottom-right status bar → Save with Encoding → UTF-8.
- Notepad++: Encoding menu → Convert to UTF-8. Use Convert, not Encode in: the second option only changes how the file is read and doesn’t fix the characters.
Make a copy of the file before converting it.
3. Check the database and the connection
Accents break when the table, the connection and the page don’t use the same encoding. Use utf8mb4 for both the tables and the connection.
- If you coded your site in PHP, set the encoding when you connect:
mysqli_set_charset($connection, 'utf8mb4');or, with PDO, add;charset=utf8mb4to your DSN. - If it started after moving or importing the site, the database was most likely exported with one encoding and imported with another. Export and import it again choosing UTF-8; see export and import a database with phpMyAdmin.
Did it start right after you switched hosting? With our free migration we copy your files and database keeping UTF-8, so you don’t have to redo the export.
Careful: if your site already has many records saved with é, don’t change the database settings blindly (for example DB_CHARSET in WordPress). You can make it worse. Take a backup first.
If you still see strange symbols
- Only in emails your site sends (forms, notifications): set UTF-8 in the script that sends the email; in PHPMailer it’s
$mail->CharSet = 'UTF-8';. - In a CSV file opened in Excel: don’t open it with a double-click. In Excel go to Data → From Text/CSV and under File Origin choose 65001: Unicode (UTF-8).
- Nothing above works: open a ticket with the URL where you see the symbols and a screenshot.
Recommended reading
Still need help?
If this guide didn’t solve your issue, our team can help you via ticket.