/*Here I have a class that will convert ISCII (Indian Standard Code for Information Interchange) devnagiri (Hindi) string to unicode string. /*
<?php
class iscii2utf8 {
var $map;
function iscii2utf8() {
$this->map = array (
"a0" => '63' ,
"a1" => '2305' ,
"a2" => '2306' ,
"a3" => '2307' ,
"a4" => '2309' ,
"a5" => '2310' ,
"a6" => '2311' ,
"a7" => '2312' ,
"a8" => '2313' ,
"a9" => '2314' ,
"aa" => '2315' ,
"ab" => '2318' ,
"ac" => '2319' ,
"ad" => '2320' ,
"ae" => '2317' ,
"af" => '2322' ,
"b0" => '2323' ,
"b1" => '2324' ,
"b2" => '2321' ,
"b3" => '2325' ,
"b4" => '2326' ,
"b5" => '2327' ,
"b6" => '2328' ,
"b7" => '2329' ,
"b8" => '2330' ,
"b9" => '2331' ,
"ba" => '2332' ,
"bb" => '2333' ,
"bc" => '2334' ,
"bd" => '2335' ,
"be" => '2336' ,
"bf" => '2337' ,
"c0" => '2338' ,
"c1" => '2339' ,
"c2" => '2340' ,
"c3" => '2341' ,
"c4" => '2342' ,
"c5" => '2343' ,
"c6" => '2344' ,
"c7" => '2345' ,
"c8" => '2346' ,
"c9" => '2347' ,
"ca" => '2348' ,
"cb" => '2349' ,
"cc" => '2350' ,
"cd" => '2351' ,
"ce" => '2399' ,
"cf" => '2352' ,
"d0" => '2353' ,
"d1" => '2354' ,
"d2" => '2355' ,
"d3" => '2356' ,
"d4" => '2357' ,
"d5" => '2358' ,
"d6" => '2359' ,
"d7" => '2360' ,
"d8" => '2361' ,
"d9" => '63' ,
"da" => '2366' ,
"db" => '2367' ,
"dc" => '2368' ,
"dd" => '2369' ,
"de" => '2370' ,
"df" => '2371' ,
"e0" => '2374' ,
"e1" => '2375' ,
"e2" => '2376' ,
"e3" => '2373' ,
"e4" => '2378' ,
"e5" => '2379' ,
"e6" => '2380' ,
"e7" => '2377' ,
"e8" => '2381' ,
"e9" => '63' ,
"ea" => '2404' ,
"eb" => '63' ,
"ec" => '63' ,
"ed" => '63' ,
"ee" => '63' ,
"ef" => '63' ,
"f0" => '63' ,
"f1" => '2406' ,
"f2" => '2407' ,
"f3" => '2408' ,
"f4" => '2409' ,
"f5" => '2410' ,
"f6" => '2411' ,
"f7" => '2412' ,
"f8" => '2413' ,
"f9" => '2414' ,
"fa" => '2415' ,
"fb" => '63' ,
"fc" => '63' ,
"fd" => '63' ,
"fe" => '63' ,
"ff" => '63' ,);
}
function code2utf($num){
if($num<128)return chr($num);
if($num<1024)return chr(($num>>6)+192).chr(($num&63)+128);
if($num<32768)return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128);
if($num<2097152)return chr($num>>18+240).chr((($num>>12)&63)+128).chr(($num>>6)&63+128). chr($num&63+128);
return '';
}
function convertstring($iscii) {
$str = "";
for($i = 0; $i<strlen($iscii); $i++) {
$c = dechex(ord(substr($iscii,$i,1)));
if (isset($this->map[$c] )) {
$s = $this->code2utf($this->map[$c]);
$str .= ($s == "?")?"":$s;
}
else {
$str .= substr($iscii,$i,1);
}
}
return $str;
}
}
?>