JavaScript Unicode编码和反编码

[ 2004-09-09 00:42:58 | Author: zhenhua ]
Font Size: Large | Medium | Small
<script>
function unicode(s){
 var len=s.length;
 var rs="";
 for(var i=0;i<len;i++){
 var k=s.substring(i,i+1);
 rs+="&#"+s.charCodeAt(i)+";";
 }
 return rs;
}

function runicode(s){
 var k=s.split(";");
 var rs="";
 for(i=0;i<k.length;i++){
 var m=k.replace(/&#/,"");
 rs+=String.fromCharCode(m);
 }
 return rs;
}
alert(unicode("我是一个神"));//我是一个神
alert(runicode("我是一个神"));
</script>

Comments Feed Comments Feed: http://www.zhenhua.org/feed.asp?q=comment&id=164
UTF-8 Encoding Trackback URL: http://www.zhenhua.org/trackback.asp?id=164

View Mode: Show All | Comments: 0 | Trackbacks: 348 | Toggle Order | Views: 31080
Trackback montgomery canadian pharmacy
[ montgomery canadian pharmacy | 2012-11-28 02:51:39 ]
Brand and Generic Drugs, Discount Pharmacy. All information about montgomery canadian pharmacy in one place: http://perso.wanadoo.es/heavenhell/canadian-pharmacy/montgomery-canadian-pharmacy.html
Trackback glendale steroid
[ glendale steroid | 2012-12-15 10:23:44 ]
Brand and Generic Drugs, Discount Pharmacy. All information about glendale steroid in one place: http://wach.pluto.ro/steroid/glendale-steroid.html
Trackback casodex bicalutamide
[ casodex bicalutamide | 2013-01-02 02:42:27 ]
Brand and Generic Drugs, Discount Pharmacy. All information about casodex bicalutamide in one place: http://armodi.snn.gr/casodex/casodex-bicalutamide.html
Trackback medical treatment
[ medical treatment | 2013-01-10 06:16:00 ]
Brand and Generic Drugs, Discount Pharmacy. All information about medical treatment in one place: http://digilander.libero.it/alberto.pucci/phendimetrazine/medical-treatment.html
Trackback suprax cefixime
[ suprax cefixime | 2013-01-26 02:58:11 ]
Brand and Generic Drugs, Discount Pharmacy. All information about suprax cefixime in one place: http://perso.wanadoo.es/carlosblas1/suprax/suprax-cefixime.html
Trackback buy adipex online canada
[ buy adipex online canada | 2013-02-21 03:48:01 ]
Brand and Generic Drugs, Discount Pharmacy. All information about buy adipex online canada in one place: http://mitglied.multimania.de/fueger/adipex/buy-adipex-online-canada.html
Trackback distribution center
[ distribution center | 2013-02-24 06:21:55 ]
Brand and Generic Drugs, Discount Pharmacy. All information about distribution center in one place: http://digilander.libero.it/onceupon/winstrol/distribution-center.html
Trackback cheap codeine
[ cheap codeine | 2013-04-18 07:09:37 ]
Brand and Generic Drugs, Discount Pharmacy. All information about cheap codeine in one place: http://argall.altervista.org/codeine/cheap-codeine.html
Trackback tampa ventolin
[ tampa ventolin | 2013-05-17 20:44:29 ]
Brand and Generic Drugs, Discount Pharmacy. All information about tampa ventolin in one place: http://larnac.altervista.org/ventolin/tampa-ventolin.html
Trackback sustiva free shipping
[ sustiva free shipping | 2013-06-19 03:04:51 ]
Brand and Generic Drugs, Discount Pharmacy. All information about sustiva free shipping in one place: http://feyto.altervista.org/sustiva/sustiva-free-shipping.html
Trackback rivotril
[ rivotril | 2013-06-24 01:55:50 ]
Brand and Generic Drugs, Discount Pharmacy. All information about rivotril in one place: http://mitglied.multimania.de/lysen/rivotril/
Trackback buy pills online
[ buy pills online | 2013-07-04 02:10:29 ]
Brand and Generic Drugs, Discount Pharmacy. All information about buy pills online in one place: http://perso.wanadoo.es/aseradura/cisapride/buy-pills-online.html
Trackback lakeland sertraline
[ lakeland sertraline | 2013-07-13 09:23:18 ]
Brand and Generic Drugs, Discount Pharmacy. All information about lakeland sertraline in one place: http://digilander.libero.it/zappa93/sertraline/lakeland-sertraline.html
Trackback murrieta zolpidem
[ murrieta zolpidem | 2013-07-16 08:11:49 ]
Brand and Generic Drugs, Discount Pharmacy. All information about murrieta zolpidem in one place: http://hem.passagen.se/kpettson/zolpidem/murrieta-zolpidem.html
Trackback fastin blue
[ fastin blue | 2013-07-19 01:30:03 ]
Brand and Generic Drugs, Discount Pharmacy. All information about fastin blue in one place: http://donne.pluto.ro/fastin/fastin-blue.html
Trackback nystatin oral rinse
[ nystatin oral rinse | 2013-08-02 08:24:08 ]
Brand and Generic Drugs, Discount Pharmacy. All information about nystatin oral rinse in one place: http://hem.passagen.se/tjadden1/nystatin/nystatin-oral-rinse.html
Trackback fexofenadine medication
[ fexofenadine medication | 2013-08-29 02:51:28 ]
Brand and Generic Drugs, Discount Pharmacy. All information about fexofenadine medication in one place: http://bodice.altervista.org/fexofenadine/fexofenadine-medication.html
Trackback levothyroxine sodium
[ levothyroxine sodium | 2013-09-02 04:40:33 ]
Brand and Generic Drugs, Discount Pharmacy. All information about levothyroxine sodium in one place: http://digilander.libero.it/amalament/levothyroxine-sodium/
Trackback wholesale depot
[ wholesale depot | 2013-09-07 00:35:14 ]
Brand and Generic Drugs, Discount Pharmacy. All information about wholesale depot in one place: http://baader.pluto.ro/penis-enlargement-pill/wholesale-depot.html
Trackback bupropion sdz sr
[ bupropion sdz sr | 2013-09-11 02:03:49 ]
Brand and Generic Drugs, Discount Pharmacy. All information about bupropion sdz sr in one place: http://rincon.snn.gr/bupropion/bupropion-sdz-sr.html

If you feel this site you find this information helpful, please click on the donation, which is voluntary,Thank you.
Post Comment
Smilies
[arrow] [biggrin] [confused] [cool]
[cry] [eek] [evil] [exclaim]
[frown] [idea] [lol] [mad]
[mrgreen] [neutral] [question] [razz]
[redface] [rolleyes] [sad] [smile]
[surprised] [twisted] [wink]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code