Recently, I was reviewing an old PHP I'd created for sending mails. It's a fairly small script with basic input validation using regex. All good, but than I noticed this line of code:

'Content-Type' => 'text/html; charset=ISO-8859-1'

Something felt strange - it's supposed to be charset UTF-8 instead ISO-8859-1 which is rarely encountered in the websites' markup. And so, I started researching.

Both, UTF-8 and ISO-8859-1 are character encoding schemes.

UTF-8 is a Unicode character encoding that can represent all possible characters defined by the Unicode standard. It is commonly used on the web, due to its ability to accommodate all languages and its strong support in web browsers.

ISO-8859-1, also referred as Latin-1, is a character encoding that represents a limited range of characters mainly used in Western European languages. It lacks support for characters from other scripts like Greek, Cyrillic, or Chinese.

A simple real-life test #

You can test the differences between the two character sets when you use € (Euro Sign). UTF-8 displays it correctly but with ISO-8859-1 it might appear as a jumble of strange symbols. So, if you ever encounter character display issues, the character encoding is the first thing to investigate.


In a nutshell, UTF-8 is a more comprehensive and flexible encoding that can represent a wider range of characters, while ISO-8859-1 is a more limited encoding suited mainly for Western European languages.

For most websites, UTF-8 is the clear winner, just stick with it and you'll rarely encounter character issues on your site.