以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  xml中html表单如何提交GB2312格式的数据  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=5621)


--  作者:sisyphos
--  发布时间:3/11/2004 7:18:00 PM

--  xml中html表单如何提交GB2312格式的数据
有post.xml和post.xsl文件(两个文件的字符都使用了GB2312)。
其中post.xsl文件见下,其中post.xsl文件里用了html表单,
可是等表单提交后发现,所有数据都自动变成是utf-8格式的。

请问如何才能让提交的数据是GB2312的呢?
或者如何转换成GB2312(php环境下)?


<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>

<xsl:template match="/">
<html>
<head>
<title>www.sisyphosorg.org</title>
<Script Language="JavaScript">
function upload(parm){
window.open("/upload.php?" + parm,"","location='no',menubar='no',status='no',t
oolbar='no',width='550',height='400',left='100',top='100'");
}
</Script>
</head>
<body background="images/imgs/main.jpg" bgproperties="fixed">
<center>
<form encoding="GB2312" method="post" name="bbspst" action="bbspst.php?act=sav
e">
<table class="title" width="90%">
<tr>
<th class="title" width="33%" align="left">发表文章</th>
<th id="Title" class="title" width="33%" align="center">雅典公园BBS站</th>
<th class="title" width="34%" align="right">讨论区 [Secondhand]</th>
</tr>
</table>
<hr/>
<table class="post">
<tr>
<td class="post">文章标题
<input type="text" name="post_subject" size="43" maxlength="43" value=""/>
<input type="radio" name="post_reply" value="1"/>可回复
<input type="radio" name="post_reply" value="0"/>不可回复
</td>
</tr>
<tr>
<td class="post">附签名档
<select name="signature">
<option value="0">无签名档</option>
<option value="1">签名档01</option>
</select>
<input type="hidden" value="查看签名档" onclick=""/>
</td>
</tr>
<tr>
<td class="post">
<textarea name="post_text" rows="25" cols="78" wrap="physicle"></textarea>
</td>
</tr>
<tr>
<td class="post" align="center">
<input type="submit" name="submit" value="发表"/><![CDATA[ ]]>
<input type="reset" value="清除"/><![CDATA[ ]]>
<input type="button" onclick="upload('id=ytliu=1078918922')" value="附件"/>
<input type="hidden" name="board" value="secondhand"/>
</td>
</tr>
</table>
<hr/>
</form>
</center>
</body>
</html>
</xsl:template>
</xsl:stylesheet>


--  作者:jadedrip
--  发布时间:3/12/2004 11:03:00 AM

--  
在 xsl 文件中 <head> 中 加入 <meta content="text/html; charset=gb2312" http-equiv="Content-Type"/> 试试
--  作者:sisyphos
--  发布时间:3/13/2004 3:43:00 AM

--  
还是不可以啊
--  作者:jadedrip
--  发布时间:3/15/2004 9:50:00 AM

--  
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="html" version="4.0" encoding="GB2312" indent="yes"/>

那就在用这样的文件头看看,不行的话,用PHP转换代码算了。


--  作者:sisyphos
--  发布时间:3/18/2004 3:48:00 PM

--  
不错,果然可以,哈哈,谢谢。。:)
--  作者:sisyphos
--  发布时间:3/18/2004 3:57:00 PM

--  
查标准函数里没有utf8和gb2312互相转换的代码啊
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms