首页 > 信息系统 > GB2312简体文字转换UTF-8 转换工具

GB2312简体文字转换UTF-8 转换工具

2009年6月9日 17:23 736 人浏览

将下面的代码保存为HTML就可运行

<html>
<head>
<title>UTF-8 转码工具</title>
<style type=”text/css”>
<!–
.bicyle {
font-family: “Times New Roman”, “Times”, “serif”;
font-size: 12px;
background-color: #FFFFFF;
}
–>
</style>
</head>
<body>
<div align=center>
<center>
    <table border=0 cellpadding=0 cellspacing=0 style=”border-collapse: collapse” width=90% id=bicyle height=52>
      <tr>
        <td width=100% height=13> <p align=center class=”bicyle”><font color=#FF0000 size=3 face=Arial, Helvetica, sans-serif><strong>UTF-8
            转码工具</strong></font></p>
        </td>
      </tr>
      <tr>
        <td height=6><div align=”center”>
            <textarea name=”textarea” cols=82 rows=10 id=code>在些输入你要转换的内容文字</textarea>
          </div></td>
      </tr>
      <tr>
        <td height=7><div align=”center”>
            <input name=”button” type=button onClick=encode(code,this) value=转化>
            <script>
var mode=”zhuan”;
function encode(obj,btn){
    if(mode==”zhuan”){
        obj.value=obj.value.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,”&#x$2;”)});
        btn.value=”还原”;
        mode=”huan”;
    }else{
        obj.value=unescape(obj.value.replace(/&#x/g,’%u’).replace(/;/g,”));
        btn.value=”转化”;
        mode=”zhuan”;
    }
}
</script>
          </div></td>
      </tr>
    </table>
</center>
</div>
</body>
</html>



分类: 信息系统 标签:
  1. 2009年6月11日01:42 | #1

    Thanks for posting, I’ll definitely be subscribing to your blog.

    • admin
      2009年6月11日09:02 | #2

      I was also in Beijing, how do you make money GOOGLE, pay a friend to explore- – -

  2. 2009年6月13日04:08 | #3

    Hey, nice post, very well written. You should blog more about this. I’ll certainly be subscribing.

  3. 2009年6月13日15:53 | #5

    OKK

本文的评论功能被关闭了.