【发布时间】:2016-03-24 10:47:47
【问题描述】:
在utf-8和我的所有页面中使用mysql数据库后,检查编码并包含
@ Language = VBScript CodePage = 65001
在HTML页面中,包括:
meta charset = "utf-8"
在我不得不更改上传系统之前,一切都非常顺利。 现在,我正在使用 Pure Asp Upload 来发送图像,这很棒,但我需要你的帮助,因为其他文本字段太疯狂了。
我做了一个非常简单的代码,只有一个文件字段和一个文本字段,只是为了举例说明,并在他取字段后不久给出一个 Response.End() 只是想看看会发生什么,但几天后没有成功,来帮忙。
Pure Asp Upload 版本为 2.06
<%@ Language=VBScript CodePage=65001%>
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate"
%>
<!--#include file="../includes/pure-upload.asp"-->
<% Session.Timeout = 60 %>
<%
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate"
%>
<%
sAction = Request.querystring("a_edit")
If sAction = "" Or IsNull(sAction) Then
sAction = "I" ' Display Record
else
Dim fupload: Set fupload = New ASPForm
Server.ScriptTimeout = 2000
fupload.SizeLimit = 4*1000000 'limit of size per whole form
Const fsCompletted = 0
If fupload.State = fsCompletted Then 'Completted
fupload.CharSet = Response.CharSet
x_jogadorID = fupload("x_jogadorID")
x_jogadorNome = fupload.Item("x_jogadorNome")
meukarma = fupload.CharSet
response.write x_jogadorNome & "-" & meukarma
response.End()
ElseIf fupload.State > 10 then
Const fsSizeLimit = &HD
Select case fupload.State
case fsSizeLimit
Session(ewSessionMessage) = "<br><Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font><br>"
Session(ewSessionMessageTipo) = "error"
case else
Session(ewSessionMessage) = "<Font Color=red>Erro no Formulário." & Form.State & "</Font><br>"
Session(ewSessionMessageTipo) = "error"
end Select
End If 'Form.State = 0 then
End If
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>teste</title>
</head>
<body>
<form name="fjogadoredit" id="fjogadoredit" action="teste.asp?a_edit=U" class="form-horizontal" method="post" enctype="multipart/form-data" onSubmit="return EW_checkMyForm(this);" >
<input type="text" name="x_jogadorNome" id="x_jogadorNome" class="input-xlarge" maxlength="50" value="<%= Server.HTMLEncode(x_jogadorNome&"") %>">
<input type="file" id="x_jogadorFotoRosto" name="x_jogadorFotoRosto" class="default">
</form>
</body>
</html>
我是一个注册测试的名字是Amésio,更改为:
amnésio
如果我早在第二行就把块放在下面,Amésio 的结果是
amnésio
<%
Response.AddHeader "Content-Type", "text/html; charset=utf-8"
response.Charset="utf-8"
%>
有人设法以这种方式使用这个组件,或者像它那样设法解决了吗?
【问题讨论】:
-
Pointer... 不要
Server.HTMLEncode()值,否则它会与您已经设置的编码背道而驰。如果编码正确,则无需进一步编码值。 -
您是否尝试过写出
Response.Charset以查看它是否设置为UTF-8,因为在将其分配给fupload.CharSet之前您似乎没有在页面中设置它您可以编辑吗问题并添加response.write x_jogadorNome & "-" & meukarma的输出? -
对不起,我的意思是
Response.CodePage,如果不是65001,那是你的问题。在发送处理HTML之前设置它,你应该没问题。 -
我在第一行代码上定义了代码页,所有包含的文件都被检查了,它们保存在 utf-8 上,只有
Form.CharSet = Response.CharSet没有解决我的问题...我尝试创建一个属性 get/设置为使用 65001。我真的知道我的 probelma 并不简单,但是,我的所有页面都正常工作......我尝试使用 persits.aspuload,并且,当从他那里设置代码页时,工作得很好,但我想使用 Pure Asp 上传。
标签: mysql utf-8 vbscript asp-classic upload