Because it is something in someone else's database, it is traditional. There are a lot of good things that don't have to put it out how to convert it. Dear help.
-------------------------------------------------- -------------
Function Isbig5 ($ CODE)
{
IF (Strlen> = 2)
{
$ CODE = STRTOK ($ CODE, ");
IF (ORD ($ CODE [0]) <161)
{
Return (0);
}
Else
{
IF ((($ code [1])> = 64) && (ORD ($ code [1]) <= 126)) | | (((4)> = 161) && (Ord ($ CODE [1]) <= 254))))))
{
Return (1);
}
Else
{
Return (0);
}
}
}
Else
{
Return (0);
}
}
Function Big5offset ($ CODE)
{
IF (Strlen> = 2)
{
$ CODE = STRTOK ($ CODE, ");
IF (($ code [1])> = 64) && (ORD ($ code [1]) <= 126))
{
RETURN (($ code [0]) - 161) * 157 (ORD ($ CODE [1]) - 64)
}
IF (($ code [1])> = 161) && (ORD ($ code [1]) <= 254))
{
Return (($ CODE [0]) - 161) * 157 63 (ORD ($ CODE [1]) - 161));
}
}
Return (-1);
}
Function WordTostring ($ CODE)
{
Return (CHR (Substr ($ CODE, 0, 2))). CHR (HEXDEC (Substr ($ Code, 2, 2)))))
}
Function Big5TOGB ($ CODE)
{
Include "data_big5.php";
$ OUTPUT = ""
$ length = Strlen ($ code);
$ CODE = STRTOK ($ CODE, ");
$ IDX = 0;
While ($ IDX <$ toughth)
{
$ Tmpstr = $ Code [$ IDX]. $ code [$ IDX 1];
IF (Isbig5 ($ TMPSTR))
{
$ OFFSET = BIG5OFFSET ($ TMPSTR);
IF ($ OFFSET> = 0) | | ($ OFFSET <= 14757)))
{
$ output. = WordTostring ($ BIG5ORDER [$ OFFSET]);
$ IDX ;
}
Else
{
$ OTPUT. = $ code [$ IDX];
}
}
Else
{
$ OTPUT. = $ code [$ IDX];
}
$ IDX ;
}
Return ($ OTPUT);
}
?>