Revision: 55976
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 2, 2012 16:28 by KuhlMensch
Initial Code
$GLOBALS['normalizeChars'] = array( 'Ã…Â '=>'S', 'Å¡'=>'s', 'Ž'=>'Z', 'ž'=>'z', '�'=>'A', '�'=>'A', '�'=>'A', '�'=>'A', '�'=>'A', '�'=>'A', '�'=>'A', '�'=>'C', '�'=>'E', '�'=>'E', '�'=>'E', '�'=>'E', '�'=>'I', '�'=>'I', '�'=>'I', '�'=>'I', '�'=>'N', '�'=>'O', '�'=>'O', '�'=>'O', '�'=>'O', '�'=>'O', '�'=>'O', '�'=>'U', '�'=>'U', '�'=>'U', '�'=>'U', '�'=>'Y', '�'=>'B', '�'=>'Ss', 'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'Ã¥'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'ÃÂ'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y' ); function cleanForShortURL($toClean) { $toClean = iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $toClean ); return strtr($toClean, $GLOBALS['normalizeChars']); }
Initial URL
Initial Description
I was trying to remove accented characters and the character substitution was incorrect. After mucking around I realised I needed to encode. I don't know exactly why I needed to force encoding. It might simply be because the server was linux.
Initial Title
iconv: Force encoding before removing accented characters
Initial Tags
Initial Language
PHP