为什么我的下载程序会有时候下载不了中文的文件的?

miaomiaoga 2003-11-23 01:31:48

源代码如下:
<td><a href="<%=Rs_Bs("urlpath") & Rs_Bs("filename")%>"><%=Rs_Bs("filename")%></a></td>

urlpath为:
/demo/admin/Maintenance/Documents/data/

filename为:
无废话XML.pdf

两个字段在数据里都是NVARCHAR型的,有时候点击文件名会显示没该文件,但有些却没问题,英文文件名的就完全没事,只有在中文文件名时才会出现这种情况(有些可以有些不可以),知道这个问题不好回答,但急待解决,希望各位指教指教。:)先谢了。
...全文
41 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
eafin 2003-11-26
  • 打赏
  • 举报
回复
<%
Function GetUrl()
On Error Resume Next
Dim strTemp
If LCase(Request.ServerVariables("HTTPS")) = "off" Then
strTemp = "http://"
Else
strTemp = "https://"
End If
strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
If Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
strTemp = strTemp & Request.ServerVariables("URL")
If Trim(Request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString)
GetUrl = strTemp
End Function

Function Getutf(title)
if not isnull(title) then
title = Server.URLEncode(GetUrl())
title = replace(title,"%2E",".")
title = replace(title,"%2F","/")
title = replace(title,"%3A",":")
title = replace(title,"%2D","-")
title = replace(title,"%5F","_")
title = replace(title,"%3D","=")
title = replace(title,"%3F","?")
title = replace(title,"%26","&")
title = replace(title,"%25","%")
Getutf = title
end if
End Function

response.write("得到Url: ")
response.write GetUrl()
response.write("<br/>")
response.write("得到经过UTF-8编码的Url: ")
response.write getutf(GetUrl())
%>
flygoocn 2003-11-26
  • 打赏
  • 举报
回复
切换成unicode的
getUrlEncodel(文件名)

28,390

社区成员

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

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