Chinese characters transformed into pinyin (JSP version)

xiaoxiao2021-03-06  106

Many problems are because the file names caused by Chinese issues are best not to use Chinese now solving, which is generally generated, making this ID, filename, if the URL belongs to Chinese characters, often errors, usually use URLENCode encoding Now use this conversion, it has a lot of principles: use hash table technology hashtable ht = new hashtable (10); 1. Add index, such as: ht.put ("- 20295", "ang"); 2. Reverse traversal , Such as: while (! Ht.containskey)) Num -; <% @ page language = "java" import = "java.util. *" Contenttype = "text / html"%> < %! Hashtable HT = New Hashtable (10); String G (Integer N) {Int Num = n.intValue (); if (Num> 0 && Num <160) {Return String.Valueof ((char) NUM);} else (NUM <-20319 || Num> -10247) {RETURN "";} else {if (ht.size () == 0) {b ();} while (! ht.containskey (integer.tostring (NUM) )) Num-- ​​Ht.Get (Integer.Tostring (NUM)). TOSTRING ();}} String C (String Str) {char [] hz = str.tochararray (); int Len = str.length ); Int P, q; string Ret = ""; for (int i = 0; i 160) {q = (int) HZ [ i]; p = p * 256 q-65536;} RET = G (New Integer (P));} return return;} void b () {ht.put ("- 20319", "a" ); Ht.Put ("- 20317", "ai"); HT.PUT ("- 20304", "an"); HT.PUT ("- 20295", "ang"); ht.put (" 20292 "," AO "); ht.put (" - 20283 "," ba "); HT.PUT (" - 20265 "," bai); HT.PUT ("- 20257", "ban"); HT.PUT ("- 20242", "bang"); HT .put ("- 20230", "bao"); HT.PUT ("- 20051", "bei"); HT.PUT ("- 20036", "BEN"); HT.PUT ("- 20032", "beng"); HT.PUT ("- 20026", "bi"); HT.PUT ("- 20002", "bian); HT.PUT (" - 19990 "," biao "); ht.put ("

-19986, "Bie"); HT.PUT ("- 19982", "bin"); HT.PUT ("- 19976", "bing"); HT.PUT ("- 19805", "bo") Ht.PUT ("- 19784", "bu"); HT.PUT ("- 19775", "ca"); HT.PUT ("- 19774", "cai"); ht.put ("- 19763 "" CAN "); HT.PUT (" - 19756 "," ca Gu "); HT.PUT (" - 19751 "," cao "); HT.PUT (" - 19746 "," ce "); HT .put ("- 19741", "keng"); HT.PUT ("- 19739", "cha"); HT.PUT ("- 19728", "chai"); HT.PUT ("- 19725", "CHAN"); HT.PUT ("- 19715", "chang"); HT.PUT ("- 19540", "chao"); HT.PUT ("- 19531", "che"); ht.put ("-19525", "chen"); HT.PUT ("- 19515", "Cheng"); HT.PUT ("- 19500", "chi"); HT.PUT ("- 19484", "chong "); HT.PUT (" - 19479 "," chou "); HT.PUT (" - 19467 "," chu "); HT.PUT (" - 19289 "," chuai "); ht.put (" -19288, "Chuan"); HT.PUT ("- 19281", "chuang"); HT.PUT ("- 19275", "chui"); HT.PUT ("- 19270", "chun") Ht.Put ("- 19263", "chuo"); HT.PUT ("- 19261", "ci"); HT.PUT ("- 19249", "cong"); ht.put ("- 19243 "," cou "); HT.PUT (" - 19242 "," cu "); HT.PUT (" - 19238 "," cuan "); HT.PUT (" - 19235 "," cui "); HT .put ("- 19227", "cun"); HT.PUT ("- 19224", "cuo"); HT.PUT ("- 19218", "da"); ht.put ("- 19212", "Dai"); HT.PUT ("- 19038", "dan"); ht.pu T ("- 19023", "dang"); HT.PUT ("- 19018", "dao"); HT.PUT ("- 19006"

"de"); HT.PUT ("- 19003", "deng"); HT.PUT ("- 18996", "di"); HT.PUT ("- 18977", "Dian"); HT. PUT ("- 18961", "DIAO"); HT.PUT ("- 18952", "DIE"); HT.PUT ("- 18783", "ding"); HT.PUT ("- 18774", " "); HT.PUT (" - 18773 "," dong "); HT.PUT (" - 18763 "," dou "); HT.PUT (" - 18756 "," du "); ht.put "-18741", "duan"); HT.PUT ("- 18735", "dui"); HT.PUT ("- 18731", "dun"); HT.PUT ("- 18722", "duo" ); Ht.Put ("- 18710", "e"); HT.PUT ("- 18697", "en"); HT.PUT ("- 18696", "ER"); ht.put (" 18526 "" FA "); HT.PUT (" - 18518 "," Fan "); HT.PUT (" - 18501 "," fang "); HT.PUT (" - 18490 "," fei "); HT.PUT ("- 18478", "fen"); HT.PUT ("- 18463", "feng"); HT.PUT ("- 18448", "fo"); ht.put ("- 18447" , "fou"); HT.PUT ("- 18446", "fu"); HT.PUT ("- 18239", "ga"); HT.PUT ("- 18237", "gai"); HT. PUT ("- 18231", "gan"); HT.PUT ("- 18220", "gang"); HT.PUT ("- 18211", "gao"); HT.PUT ("- 18201", " GE "); HT.PUT (" - 18184 "," gei "); HT.PUT (" - 18183 "," gen "); HT.PUT (" - 18181 "," geng "); ht.put "-18012", "gong"); HT.PUT ("- 17997", "gou"); HT.PUT ("- 17988", "gu"); ht.put ("- 17970", "gua" Ht.Put ("- 17964", "guai"); HT.PUT ("- 17961", "guan"); ht.put "-17950", "guang"); HT.PUT ("- 17947", "gui"); ht.put ("

-17931, "Gun"); HT.PUT ("- 17928", "guo"); HT.PUT ("- 17922", "ha"); HT.PUT ("- 17759", "hai") Ht.PUT ("- 17752", "han"); HT.PUT ("- 17733", "hang"); HT.PUT ("- 17730", "hao"); ht.put ("- 17721 "" HE "); HT.PUT (" - 17703 "," hei "); HT.PUT (" - 17701 "," hen "); HT.PUT (" - 17697 "," heng "); HT .put ("- 17692", "hong"); HT.PUT ("- 17683", "hou"); HT.PUT ("- 17676", "hu"); ht.put ("- 17496", "hua"); ht.put ("- 17487", "huai"); HT.PUT ("- 17482", "huan"); HT.PUT ("- 17468", "huang"); ht.put ("-17454", "hui"); HT.PUT ("- 17433", "hun"); HT.PUT ("- 17427", "huo"); HT.PUT ("- 17417", "ji "); HT.PUT (" - 17202 "," jia); HT.PUT ("- 17185", "jian); ht.put (" - 16983 "," jiang "); ht.put (" -16970 "," jiao "); HT.PUT (" - 16942 "," jie "); HT.PUT (" - 16915 "," jin "); ht.put (" - 16733 "," jing ") HT.PUT ("- 16708", "jiong"); HT.PUT ("- 16706", "jiu); ht.put (" - 16689 "," ju "); ht.put (" - 16664 "," juan "); HT.PUT (" - 16657 "," jue); HT.PUT ("- 16647", "jun); HT.PUT (" - 16474 "," ka "); HT .put ("- 16470", "kai"); HT.PUT ("- 16465", "kan); HT.PUT (" - 16459 "," kang "); HT.PUT (" - 16452 ", "kao"); HT.PUT ("- 16448", "ke"); ht.put ("- 16433" , "ken"); HT.PUT ("- 16429", "keng"); ht.put ("- 16427", "

"); HT.PUT (" - 16423 "," kou "); HT.PUT (" - 16419 "," ku "); HT.PUT (" - 16412 "," kua "); ht.put "-16407", "kuai"); HT.PUT ("- 16403", "kuan"); HT.PUT ("- 16401", "kuang"); HT.PUT ("- 16393", "kui" Ht.PUT ("- 16220", "kun"); HT.PUT ("- 16216", "kuo"); HT.PUT ("- 16212", "la"); ht.put (" 16205 "," LAI "); HT.PUT (" - 16202 "," LAN "); HT.PUT (" - 16187 "," lang "); HT.PUT (" - 16180 "," lao "); HT.PUT ("- 16171", "le"); HT.PUT ("- 16169", "lei"); HT.PUT ("- 16158", "leng"); ht.put ("- 16155" , "Li"); HT.PUT ("- 15959", "LIA); HT.PUT (" - 15958 "," lian "); HT.PUT (" - 15944 "," liang "); HT. PUT ("- 15933", "liao"); HT.PUT ("- 15920", "lie"); HT.PUT ("- 15915", "lin"); ht.put ("- 15903", " "); HT.PUT (" - 15889 "," liu "); HT.PUT (" - 15878 "," long "); HT.PUT (" - 15707 "," lou "); ht.put "-15701", "lu"); HT.PUT ("- 15681", "lv"); HT.PUT ("- 15667", "luan"); HT.PUT ("- 15661", "lue" Ht.Put ("- 15659", "lun"); HT.PUT ("- 15652", "luo"); HT.PUT ("- 15640", "mA"); ht.put ("- 15631 "," MAI "); HT.PUT (" - 15625 "," Man "); HT.PUT (" - 15454 "," mang "); HT.PUT (" - 15448 "," mao "); HT.PUT ("- 15436", "me"); HT.PUT ("- 15435", "mei"); HT .put ("- 15419", "men"); HT.PUT ("- 15416", "meng"); ht.put ("

-15408, "Mi"); HT.PUT ("- 15394", "mian); HT.PUT (" - 15385 "," miao "); HT.PUT (" - 15377 "," mie ") Ht.Put ("- 15375", "min"); HT.PUT ("- 15369", "ming"); HT.PUT ("- 15363", "miu"); ht.put ("- 15362 "," mo "); HT.PUT (" - 15183 "," mou "); HT.PUT (" - 15180 "," mu "); HT.PUT (" - 15165 "," na "); HT .put ("- 15158", "nai"); HT.PUT ("- 15153", "nan"); HT.PUT ("- 15150", "nang"); HT.PUT ("- 15149", "nao"); HT.PUT ("- 15144", "ne"); HT.PUT ("- 15143", "nei"); HT.PUT ("- 15141", "nen"); ht.put ("-15140", "NENG"); HT.PUT ("- 15139", "Ni"); HT.PUT ("- 15128", "nian"); HT.PUT ("- 15121", "niang "); HT.PUT (" - 15119 "," NIAO "); HT.PUT (" - 15117 "," NIE "); HT.PUT (" - 15110 "," nin "); ht.put (" -15109, "NING"); HT.PUT ("- 14941", "niu); HT.PUT (" - 14937 "," nong "); HT.PUT (" - 14933 "," nu ") HT.PUT ("- 14930", "NV"); HT.PUT ("- 14929", "nuan"); HT.PUT ("- 14928", "nue"); ht.put ("- 14926 "," nuo "); HT.PUT (" - 14922 "," o "); HT.PUT (" - 14921 "," ou "); HT.PUT (" - 14914 "," pa "); HT .put ("- 14908", "pai"); HT.PUT ("- 14902", "PAN"); HT.PUT ("- 14894", "pang"); HT.PUT ("- 14889", "PAO"); HT.PUT ("- 14882", "pei"); HT.PUT ("- 14873", "pen"); HT.PUT ("- 14871", "peng"); HT.PUT ("- 14857", "pi");

HT.PUT ("- 14678", "PIAN); HT.PUT (" - 14674 "," piao "); HT.PUT (" - 14670 "," PIE "); HT.PUT (" - 14668 " "PIN"); HT.PUT ("- 14663", "ping"); HT.PUT ("- 14654", "PO"); HT.PUT ("- 14645", "pu"); HT. PUT ("- 14630", "qi"); HT.PUT ("- 14594", "qia); HT.PUT (" - 14429 "," qian "); ht.put (" - 14407 "," "); ht.put (" - 14399 "," qiao "); HT.PUT (" - 14384 "," qie "); HT.PUT (" - 14379 "," qin "); ht.put "-14368", "qing"); HT.PUT ("- 14355", "qiong); HT.PUT (" - 14353 "," qiu "); HT.PUT (" - 14345 "," qu " HT.PUT ("- 14170", "quan"); HT.PUT ("- 14159", "que"); HT.PUT ("- 14151", "qun"); ht.put (" 14149 "," RAN "); HT.PUT (" - 14145 "," rang "); HT.PUT (" - 14140 "," rao "); HT.PUT (" - 14137 "," re "); HT.PUT ("- 14135", "REN"); HT.PUT ("- 14125", "RENG"); HT.PUT ("- 14123", "ri"); HT.PUT ("- 14122" "rong"); HT.PUT ("- 14112", "rou"); HT.PUT ("- 14109", "ru"); HT.PUT ("- 14099", "ruan"); HT. PUT ("- 14097", "RUI"); HT.PUT ("- 14094", "run"); HT.PUT ("- 14092", "Ruo"); HT.PUT ("- 14090", " SA "); HT.PUT (" - 14087 "," SAI); HT.PUT ("- 14083", "SAN"); HT.PUT ("- 13917", "SANG"); ht.put "-13914", "SAO"); HT.PUT ("- 13910", "SE"); ht.put ("- 13907 "" SEN "); HT.PUT (" - 13906 "," seng "); ht.put ("

-13905, "SHA"); HT.PUT ("- 13896", "shai"); HT.PUT ("- 13894", "shan); ht.put (" - 13878 "," shang ") HT.PUT ("- 13870", "shao"); HT.PUT ("- 13859", "she"); ht.put ("- 13847", "shen"); ht.put ("- 13831 "," SHENG "); HT.PUT (" - 13658 "," shi "); HT.PUT (" - 13611 "," shou "); HT.PUT (" - 13601 "," shu "); HT .put ("- 13406", "shua"); HT.PUT ("- 13404", "shuai"); HT.PUT ("- 13400", "shuan"); ht.put ("- 13398", "shuan"); HT.PUT ("- 13395", "shui"); HT.PUT ("- 13391", "shun"); HT.PUT ("- 13387", "shuo"); ht.put ("-13383", "Si"); HT.PUT ("- 13367", "Song"); HT.PUT ("- 13359", "Sou"); HT.PUT ("- 13356", "SU "); HT.PUT (" - 13343 "," suan "); HT.PUT (" - 13340 "," sui "); HT.PUT (" - 13329 "," su "); ht.put (" -13326, "Suo"); HT.PUT ("- 13318", "ta"); HT.PUT ("- 13147", "tai"); ht.put ("- 13138", "tan") Ht.PUT ("- 13120", "tang"); HT.PUT ("- 13107", "tao"); HT.PUT ("- 13096", "te"); ht.put ("- 13095 "," teng "); HT.PUT (" - 13091 "," ti "); HT.PUT (" - 13076 "," tian "); HT.PUT (" - 13068 "," tiao "); HT .put ("- 13063", "tie"); ht.put ("- 13060", "ting"); HT.PUT ("- 12888", "tong"); ht.put ("- 12875", "Tou"); HT.PUT ("- 12871", "tu"); HT .put ("- 12860", "tuan"); HT.PUT ("- 12858", "tui"); ht.put ("

-12852, "TUN"); HT.PUT ("- 12849", "TUO"); HT.PUT ("- 12838", "wa"); HT.PUT ("- 12831", "WAI") HT.PUT ("- 12829", "wan"); HT.PUT ("- 12812", "wang"); HT.PUT ("- 12802", "wei"); ht.put ("- 12607 "" Wen "); HT.PUT (" - 12597 "," weng "); HT.PUT (" - 12594 "," wo "); ht.put (" - 12585 "," wu "); HT .put ("- 12556", "xi"); HT.PUT ("- 12359", "xia); HT.PUT (" - 12346 "," xian); ht.put ("- 12320", "xiang"); HT.PUT ("- 12300", "xiao); HT.PUT (" - 12120 "," xie); ht.put ("- 12099", "xin"); ht.put ("-12089", "xing"); HT.PUT ("- 12074", "xiong); HT.PUT (" - 12067 "," xiu); ht.put ("- 12058", "xu "); HT.PUT (" - 12039 "," xuan "); HT.PUT (" - 11867 "," xue "); HT.PUT (" - 11861 "," xun "); ht.put (" -11847 "" Ya "); HT.PUT (" - 11831 "," yan "); HT.PUT (" - 11798 "," yang "); HT.PUT (" - 11781 "," yao ") Ht.PUT ("- 11604", "ye"); HT.PUT ("- 11589", "yi"); HT.PUT ("- 11536", "yin"); ht.put ("- 11358 "," ying "); HT.PUT (" - 11340 "," yo "); HT.PUT (" - 11339 "," yong "); HT.PUT (" - 11324 "," you "); HT .put ("- 11303", "yu"); HT.PUT ("- 11097", "yuan"); HT.PUT ("- 11077", "yue"); ht.put ("- 11067", "Yun"); HT.PUT ("- 11055", "za"); ht.put ("- 11052", "zai" ); Ht.put ("- 11045", "zan"); HT.PUT ("- 11041", "zang");

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

New Post(0)