note 94058 modified in function.iconv by danbrown

From: Date: Wed, 14 Oct 2009 18:08:49 +0000
Subject: note 94058 modified in function.iconv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-161731@lists.php.net to get a copy of this message
to test different combinations of convertions between charsets (when we don't know the source charset and what is the convenient destination charset) this is an example : <?php $tab = array("UTF-8", "ASCII", "Windows-1252", "ISO-8859-15", "ISO-8859-1", "ISO-8859-6", "CP1256"); $chain = ""; foreach ($tab as $i) { foreach ($tab as $j) { $chain .= " $i$j ".iconv($i, $j, "$my_string"); } } echo $chain; ?> then after displaying, you use the $i$j that shows good displaying. NB: you can add other charsets to $tab to test other cases. --was-- to test different combinations of convertions between charsets (when we don't know the source charset and what is the convenient destination charset) this is an example : $tab = array("UTF-8", "ASCII", "Windows-1252", "ISO-8859-15", "ISO-8859-1", "ISO-8859-6", "CP1256"); $chain = ""; foreach ($tab as $i) { foreach ($tab as $j) { $chain .= " $i$j ".iconv($i, $j, "$my_string"); } } echo $chain; then after displaying, you use the $i$j that shows good displaying. NB: you can add other charsets to $tab to test other cases. http://php.net/manual/en/function.iconv.php

« previous php.notes (#161731) next »