The utf8_Decode Function in PHP
As a PHP or MySQL developer, sooner or later you'll get entangled in the wonderfully wacky world of character encoding. Unicode is a widely-used computing industry standard which defines a comprehensive mapping of unique numeric code values to the characters used in most of today's written languages to facilitate system inter-operability and data exchange.
The utf8_decode function is a built-in function in PHP that converts a string with UTF-8 encoding to ISO-8859-1. This is useful for converting strings that have been encoded with utf8_encode to be used in a system that only supports ISO-8859-1.
This function does not try to detect the encoding of the text it is decoding, and so may return incorrect results when trying to convert texts that have been encoded in other character encodings (such as Windows-1252 or UTF-16). For this reason it is best to use iconv() instead.
In addition, the utf8_decode function will also not properly convert text that contains characters that cannot be represented in ISO-8859-1 to ISO-8859-1. This is a common problem when attempting to convert UTF-8 text that contains the EURO sign back to ISO-8859-1.
This article is an attempt to help developers and system administrators avoid wasting time and resources on troubleshooting issues that could have been prevented by taking the time to systematically verify that their source code files, resource files, and database tables are being saved with the correct data encoding.