note 106744 deleted from function.utf8-decode by danbrown

From: Date: Tue, 06 Dec 2011 18:45:17 +0000
Subject: note 106744 deleted from function.utf8-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184955@lists.php.net to get a copy of this message
Note Submitter: maxxhome at poczta dot onet dot pl (maxx preston) ---- @mkluczka I think there is wrong "ń" and "Ń" UTF8 position in your array. Here's your function jquery2iso with fix function jquery2iso($in) { $CONV = array(); $CONV['c4']['85'] = 'ą'; $CONV['c4']['84'] = 'Ą'; $CONV['c4']['87'] = 'ć'; $CONV['c4']['86'] = 'Ć'; $CONV['c4']['99'] = 'ę'; $CONV['c4']['98'] = 'Ę'; $CONV['c5']['82'] = 'ł'; $CONV['c5']['81'] = 'Ł'; $CONV['c5']['84'] = 'ń'; //fix $CONV['c5']['83'] = 'Ń'; //fix $CONV['c3']['b3'] = 'ó'; $CONV['c3']['93'] = 'Ó'; $CONV['c5']['9b'] = 'ś'; $CONV['c5']['9a'] = 'Ś'; $CONV['c5']['ba'] = 'ź'; $CONV['c5']['b9'] = 'Ź'; $CONV['c5']['bc'] = 'ż'; $CONV['c5']['bb'] = 'Ż'; $i=0; $out = ''; while($i<strlen($in)) { if(array_key_exists(bin2hex($in[$i]), $CONV)) { $out .= $CONV[bin2hex($in[$i])][bin2hex($in[$i+1])]; $i += 2; } else { $out .= $in[$i]; $i += 1; } } return $out; }

« previous php.notes (#184955) next »