Skip to content

iconv ​

string iconv ( string $kodowanieZrodla, string $noweKodowanie , string $lancuch ) Converts $lancuch to a new character encoding.

Example:

php
$text = "This is the euro currency symbol '€'.";

print('Original  : '. $text."\n");
print('TRANSLIT  : '. iconv("UTF-8", "ISO-8859-1//TRANSLIT", $text)."\n");

$czyste = iconv("UTF-8", "ISO-8859-1", $text);
if (empty($czyste)) {
print ("An illegal character was found; conversion to ISO-8859-1 could not be completed \n").
} else {
print('Plain : '.$czyste."\n");
}

Result:

Original  : This is the euro currency symbol '€'.
TRANSLIT  : This is the euro currency symbol 'EUR'.
An illegal character was found; conversion to ISO-8859-1
could not be completed