Go to the documentation of this file.00001 <?
00002 function iso_to_utf8($str) {
00003 if (extension_loaded("mbstring"))
00004 return mb_convert_encoding($str, "UTF-8", "auto");;
00005
00006 for($x=0;$x<strlen($str);$x++) {
00007 $num=ord(substr($str,$x,1));
00008 if($num<128)
00009 $xstr.=chr($num);
00010 else if($num<1024)
00011 $xstr.=chr(($num>>6)+192).chr(($num&63)+128);
00012 else if($num<32768)
00013 $xstr.=chr(($num>>12)+240).chr((($num>>6)&63)+128).chr(($num&63)+128);
00014 else if($num<2097152)
00015 $xstr.=chr($num>>18+240).chr((($num>>12)&63)+128).chr(($num>>6)&63+128).chr($num&63+128);
00016 }
00017 return $xstr;
00018 }
00019
00020 ?>