<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title> Unicode转码 </title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><BASE onmouseover="window.status='IE->工具->Internet选项->高级->允许活动内容在我的计算机上的文件中运行';return true"><script language="javascript"><!-- function trim(text) { return text.replace(/(^\s*)|(\s*$)/g,""); } function puncode() { if(myForm.mySelect.selectedIndex==0) { var s=myForm.encoding.value; s=escape(trim(s)); s=s.replace(/\%/g,"\\"); s=s.replace(/\\5C/g,"\\"); s=s.replace(/\\0D\\0A/g,"\r\n"); myForm.reverse.value=s; }else{ var u=myForm.encoding.value; u=u.replace(/\\/g,"\%"); u=unescape(trim(u)); myForm.reverse.value=u; } myForm.encoding.scrollTop = 0; myForm.reverse.scrollTop = 0; } flag=0; function doClear(target) { if (target=='encoding') { if (flag==0) { flag=1; myForm.encoding.value = ""; } }else{ myForm.encoding.value = ""; } } //--> </script></head><body><form name=myForm><table rows=1 cols=3 align="center"><tr align="center"><td borderColor=#778899><textarea name="encoding" cols=50 rows=25 onclick="doClear('encoding');"></textarea></td><td><select name="mySelect" size="2" style="width:50pt;"><option selected>encoding</option><option>reverse</option></select><br><br><input type="button" value="转 码" onClick="puncode();"></td><td><textarea name="reverse" cols=50 rows=25></textarea></td></tr><tr align="center"><td><font color=#778899><b>┗━━━━ 转码前 ━━━━┛</b></font></td><td><input type="reset" value="清 空" onClick="flag=0;"></td><td><font color=#778899><b>┗━━━━ 转码后 ━━━━┛</b></font></td></tr></table></form></body></html>
来源:https://www.cnblogs.com/yinqi/archive/2012/12/10/2811028.html