Simplified Chinese Convert PHP Function to Traditional Chinese

xiaoxiao2021-03-06  65

Simplified Chinese Convert PHP Function to Traditional Chinese

Author: caocao Joined: 2003-11-22 Views: 279 thanks to friends Keyes provide Delphi source code for transplantation. Its call mode is $ txt = GBTOBIG5 ($ txt). (Note: Include "data_gb.php" in the source code; this file is an array, in http://caocao.oso.com.cn/data_gb.zip, edit the download to OSO, make a link, because I have to delete this file for a few days.) = 2) {$ code = strtok ($ code, ""); if ((ord ($ code [0]) <161) || (ORD ($ CODE [0])> = 247)) {RETURN (0);} else {ix (($ code [1]) <= 161) || (ORD ($ Code [1])> = 254)) {RETURN (0);} else {return (1);}}} else {RETURN (1);}} Function GBOFFSET ($ code) {if (Strlen ($ code) = 2) {$ Code = Strtok ($ code, ""); return (($ code [0]) - 161) * 94 (ORD ($ CODE [1]) - 161));} else {return (-1) Function WordTostring ($ CODE) {Return (CHR (HEXDEC (Substr ($ Code, 0, 2)))))))))). Chr (HEXDEC (Substr ($ Code, 2, 2))))))))));} Function GBTOBIG5 ($ {include "data_gb.php"; $ output = "; $ leng TH = Strlen ($ code); $ code = strtok ($ code, "); $ IDX = 0; while ($ IDX <$ length) {$ Tmpstr = $ Code [$ IDX]. $ code [$ IDX 1]; IF (ISGB ($ TMPSTR)) {$ offet = gboffset ($ TMPSTR); IF ($ OFFSET> = 0) || ($ OFFSET <= 8177)) {$ output. = WordTostring ($ GBORDER [ $ OFFSET]); $ IDX ;} else {$ output. = $ code [$ ID];}} else}} else {$ output. = $ code [$ ID];} $ IDX ;} return ($ output);}; ?>

转载请注明原文地址:https://www.9cbs.com/read-110990.html

New Post(0)