UTF-8 转码工具网页代码
时间:[2007-11-2 17:35:17] 作者:作者不详
首先我们预览一下转码的效果,如图1和图2所示,然后将代码保存为*.htm,然后在IE浏览器中打开,即可使用。
当然除了以上网页形式的工具外,您还可以使用“WAP编码转换器”,它是一款将代码、汉字在GB2312和UTF-8编码之间互转的绿色免费软件。它不仅支持文本互转,同时支持整个WAP文件整体转换。
硅谷动力下载:hTTp://download.enet.com.cn/html/030282005102602.html
UTF-8 转码工具网页代码:
<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> WAP资讯网
<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
转码工具<br>
</strong></font><font color="#0099FF">在下面的文本框中输入中文文字,按“转化”,即可将其转化为UTF-8字符。再按“还原”,即可将其还原为简体中文。</font></p>
</td>
</tr>
<tr> 7WAP
<td height=6><div align="center">
<textarea name="textarea" cols=82 rows=10 id=code>中国被爱可以在线
中国被爱可以在线专注于WAP领域、WAP软件、网页、企业行业应用等。
欢迎社会各界人士与我们携手合作,共创WAP网络辉煌。
http://www.bicyle.org
http://wap.bicyle.org
电子邮件:bicyle@126.com</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>
附另一种转换代码:
<html>
<head>
<title>UTF-8 转码工具</title>
<style>
BODY {
FONT-SIZE: 9pt; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px;
}
input {
FONT-SIZE: 9pt; height: 13pt;
}
</style>
<script language="JavaScript1.2">
/*
This following code are designed and writen by Windy_sk <seasonx@163.net>
You can use it freely, but u must held all the copyright items!
*/
function Str2Unicode(str){
var arr = new Array();
for(var i=0;i<str.length;i++){ 文章来源:www.7wap.cn,WAP资讯网
arr="&#" + str.charCodeAt(i) + ";";
}
return(arr.toString().replace(/,/g,""));
}
function Unicode2oStr(str){
var re=/&#[\da-fA-F]{1,5};/ig;
var arr=str.match(re);
if(arr==null)return("");
for(var i=0;i<arr.length;i++){
arr=String.fromCharCode(arr.replace(/[&#;]/g,""));
}
return(arr.toString().replace(/,/g,""))
}
function modi_str(){
if(document.all.text.method.checked){
if(document.all.text.decode.value!=""){
document.all.text.encode.value = Str2Unicode(document.all.text.decode.value);
}else{
document.all.text.decode.value = Unicode2oStr(document.all.text.encode.value); WAP业界动态
}
}else{
if(document.all.text.encode.value!=""){
document.all.text.decode.value = Unicode2oStr(document.all.text.encode.value);
}else{
document.all.text.encode.value = Str2Unicode(document.all.text.decode.value);
}
}
}
</script>
<title>Unicode</title>
<form name=text>
文本原型:<br>
<textarea name="decode" cols="100" rows="10"></textarea>
<br>
转换代码:<br>
<textarea name="encode" cols="100" rows="10"></textarea>
<br>
<input type="checkbox" name="method" checked> 正向转换 wap资源:www.7wap.cn
<input type=button onclick="modi_str()" value=" 确 定 ">
<input type=reset value=" 清 空 ">
<input type=button onclick="document.all.text.method.checked?document.all.text.encode.select():document.all.text.decode.select()" value=" 全 选 ">
</form>
</body>
</html>
当然除了以上网页形式的工具外,您还可以使用“WAP编码转换器”,它是一款将代码、汉字在GB2312和UTF-8编码之间互转的绿色免费软件。它不仅支持文本互转,同时支持整个WAP文件整体转换。
硅谷动力下载:hTTp://download.enet.com.cn/html/030282005102602.html
UTF-8 转码工具网页代码:
<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> WAP资讯网
<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
转码工具<br>
</strong></font><font color="#0099FF">在下面的文本框中输入中文文字,按“转化”,即可将其转化为UTF-8字符。再按“还原”,即可将其还原为简体中文。</font></p>
</td>
</tr>
<tr> 7WAP
<td height=6><div align="center">
<textarea name="textarea" cols=82 rows=10 id=code>中国被爱可以在线
中国被爱可以在线专注于WAP领域、WAP软件、网页、企业行业应用等。
欢迎社会各界人士与我们携手合作,共创WAP网络辉煌。
http://www.bicyle.org
http://wap.bicyle.org
电子邮件:bicyle@126.com</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>
附另一种转换代码:
<html>
<head>
<title>UTF-8 转码工具</title>
<style>
BODY {
FONT-SIZE: 9pt; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px;
}
input {
FONT-SIZE: 9pt; height: 13pt;
}
</style>
<script language="JavaScript1.2">
/*
This following code are designed and writen by Windy_sk <seasonx@163.net>
You can use it freely, but u must held all the copyright items!
*/
function Str2Unicode(str){
var arr = new Array();
for(var i=0;i<str.length;i++){ 文章来源:www.7wap.cn,WAP资讯网
arr="&#" + str.charCodeAt(i) + ";";
}
return(arr.toString().replace(/,/g,""));
}
function Unicode2oStr(str){
var re=/&#[\da-fA-F]{1,5};/ig;
var arr=str.match(re);
if(arr==null)return("");
for(var i=0;i<arr.length;i++){
arr=String.fromCharCode(arr.replace(/[&#;]/g,""));
}
return(arr.toString().replace(/,/g,""))
}
function modi_str(){
if(document.all.text.method.checked){
if(document.all.text.decode.value!=""){
document.all.text.encode.value = Str2Unicode(document.all.text.decode.value);
}else{
document.all.text.decode.value = Unicode2oStr(document.all.text.encode.value); WAP业界动态
}
}else{
if(document.all.text.encode.value!=""){
document.all.text.decode.value = Unicode2oStr(document.all.text.encode.value);
}else{
document.all.text.encode.value = Str2Unicode(document.all.text.decode.value);
}
}
}
</script>
<title>Unicode</title>
<form name=text>
文本原型:<br>
<textarea name="decode" cols="100" rows="10"></textarea>
<br>
转换代码:<br>
<textarea name="encode" cols="100" rows="10"></textarea>
<br>
<input type="checkbox" name="method" checked> 正向转换 wap资源:www.7wap.cn
<input type=button onclick="modi_str()" value=" 确 定 ">
<input type=reset value=" 清 空 ">
<input type=button onclick="document.all.text.method.checked?document.all.text.encode.select():document.all.text.decode.select()" value=" 全 选 ">
</form>
</body>
</html>
【声明】本站刊载的《UTF-8 转码工具网页代码 》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios