一个文件上传中的unicode编码中文乱码问题

genuis 2003-12-30 09:24:20
代码如下:使用得无组件上传
article_add.ASP

<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<link href="ad.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#DDEEFF">
<form name="form1" method="post" action="article_add1.asp" enctype="multipart/form-data" >
<tr>
<td height="26" width="176"></td>
<td height="26" width="363"><input name="Art_Title" type="text" size="60"></td>
</tr>
<tr> <td height="26" width="176"></td>
<td height="26" width="363"><input name="file1" type="file" size="60" ID=Text1></td>
</tr>
<tr>
<td colspan="2" height="28" width="540">
<div align="center">
<p> <input type="submit" name="Submit" value="up">
<input type="reset" name="Submit2" value="vv">
</p>
</div>
</td>
</tr>
</table>
</form>



article_add1.ASP

<META http-equiv=Content-Type content="text/html; charset=utf-8">
<!--#include FILE="include/upload_5xsoft.inc"-->
<%
dim upload,file,formName,formPath,iCount,sql,Art_ClassID,Art_Title,Art_Abstract,Art_Content,action,pic
set upload=new upload_5xSoft
formPath="./"
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then
pic=year(Now())&month(Now())&day(Now())&hour(Now())&minute(Now())&second(Now())&right(file.FileName,4)
file.SaveAs Server.mappath(formPath&pic)
response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&formPath&File.FileName&" <br>"
end if
set file=nothing
next
response.write Replace(upload.form("Art_Title"),"'","''")
%>

问题出现在,当文本框或者文件名 是 奇数个中文得时候,就会出现乱码
而为偶数个中文时则很正常..

有没有人遇到这个情况?如何解决? 我用其他上传组件也是一样得状况
...全文
165 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
超级大笨狼 2004-02-21
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2440/2440265.xml?temp=.3128931
genuis 2003-12-30
  • 打赏
  • 举报
回复
不行
patchclass 2003-12-30
  • 打赏
  • 举报
回复
全部用CODEPAGE="65001"
utf-8编码
patchclass 2003-12-30
  • 打赏
  • 举报
回复
上传代码里面加
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
试试看
genuis 2003-12-30
  • 打赏
  • 举报
回复
<META http-equiv=Content-Type content="text/html; charset=utf-8">
注意这一行,
如果使用 gb2312的确没有这个问题.
zhongmao 2003-12-30
  • 打赏
  • 举报
回复
在使用稻香老农的无组件上传时没有碰到过这样的问题

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧