<?
//to make the simptrad.txt file from which the characters are parsed, you should get the Unihan.txt file from the Unicode.org FTP-site
// then perform following command (on a linux machine)
// less Unihan.txt | egrep "kSimplifiedVariant|kTraditionalVariant" >> simptrad.txt
?>
<html>
<head>
<link href="style_yase.css" type="text/css" rel="stylesheet" />

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>:: Conversion of characters ::</title>
</head>
<body>
<table>
<tr bgcolor="#EEEEEE">
    <td>Original</td>
    <td>Simplified</td>
    <td>Traditional</td>
</tr>
<?
$file_open 
"simptrad.txt";
$file=file($file_open,"r");
for (
$i 1$i sizeof($file); $i++) {
$part=preg_split("/\t/",$file[$i],3);
echo 
"<tr>
    <td>"
.strip($part[0])."</td>
    "
;

if (
$part[1] == kSimplifiedVariant) {
    echo 
"<td>".get_simp($part[2])."</td>
    <td>&nbsp;</td>
</tr>
"
;
    }

if (
$part[1] == kTraditionalVariant) {    
    echo 
"<td>&nbsp;</td>
    <td>"
.get_trad($part[2])."</td>
</tr>"
;
    }
}

function 
strip($to_strip) {
    
$to_strip=ereg_replace("[U+]|\n","",$to_strip);
    
$to_strip="&#x".$to_strip.";";
    return 
$to_strip;
}
function 
get_trad($tradvar) {
    
$trad=preg_split('/ /',$tradvar);
    for (
$i 0$i sizeof($trad); $i++) {
        
$trad[$i]=strip($trad[$i]);
        
$result=$result.$trad[$i];
    }
    return 
$result;
}
function 
get_simp($simpvar) {
        
$simp=preg_split('/ /',$simpvar);
    for (
$i 0$i sizeof($simp); $i++) {
        
$simp[$i]=strip($simp[$i]);
        
$result=$result.$simp[$i];
    }
    return 
$result;
}
?>
</table>
</body>
</html>