There are two main charsets:
UTF-8lets one handle more characters than
ISO-8859-1(such as arabic and chinese characters).
HTML files that should handle unicode characters must have this set in the header:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Here one could also use 'iso-8859-1' instead.
If you need to convert between
UTF-8in PHP the functions
utf8_encodewill convert from
The use of the functions is:
$utf8string = utf8_encode( $iso-8859-1string );
$iso-8859-1string = utf8_decode( $utf8string );
In addition to
UTF-8there are two other Unicode standards
UTF-32. The difference is how many bytes are used to store a character and thus how many different characters can be stored.
UTF-32is in little use, and so is
UTF-16is used in more places.
To convert between these Unicode charsets use
iconv. It is used like this:
$utf16string = iconv("utf-8", "utf-16", $utf8str);
$utf8string = iconv("utf-16", "utf-8", $utf16str);
incovcan also be used to convert from other character sets such as
$utf16string = iconv("iso-8859-1", "utf-16", $iso-8859-1string);
Solutions found at: http://www.php.net/manual/en/function.utf8-decode.php, http://php.net/manual/en/function.utf8-encode.php, http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_21916597.html, and http://www.php.net/manual/en/function.iconv.php.