以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于get方式传递中文,中国页面后显示乱码  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=100144)

--  作者:ap9709130
--  发布时间:2017/5/5 14:59:00
--  关于get方式传递中文,中国页面后显示乱码
在用get 传递参数,如果参数中有中文,在跳转后的页面会乱码,要怎么处理。
--  作者:有点色
--  发布时间:2017/5/5 15:01:00
--  

 设置编码格式,加上代码

 

e.ResponseEncoding = "gb2312"

[此贴子已经被作者于2017/5/5 15:00:58编辑过]

--  作者:ap9709130
--  发布时间:2017/5/5 15:34:00
--  
试过了,不行。
我的网址:http://127.0.0.1:466/shfh.htm?id=24310&cid=有限公司

代码如下:

If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.Resp
            e.WriteFile(fl)
            Return \'这里必须返回
    End Select
End If
Dim sb As New StringBuilder
sb.AppendLine("<!doctype html>")
sb.AppendLine("<html>")
sb.appendLine("<head>")
sb.AppendLine("<meta charset=\'gb2312\'>")
sb.AppendLine("<meta name=\'viewport\' c>")
sb.appendLine("</head>")
sb.AppendLine("<body>")
Dim wb As New weui
Select Case e.path    
    Case shfh
        If e.GetValues.Count > 0 Then
            Dim wb As New WeUI
            wb.Title = "订单编号:" & e.GetValues("id") & ""
            wb.InsertHTML("<h3 align=\'left\' style=\'margin-top:5px\'>客户名称:" & e.GetValues("cid") & "</h3>")
            e.WriteString(wb.Build)
        End If       
End Select
sb.AppendLine("</body>")
sb.AppendLine("</html>")
End If

订单编号 可以正学显示,但是客户名称就是乱码!

--  作者:ap9709130
--  发布时间:2017/5/5 15:35:00
--  
文件发送那里已经写了:e.Resp
--  作者:有点色
--  发布时间:2017/5/5 15:37:00
--  

 代码 e.ResponseEncoding = "gb2312" 写到你3楼代码那里


--  作者:ap9709130
--  发布时间:2017/5/5 16:23:00
--  
写了啊,COPY 过来只有一半!
--  作者:ap9709130
--  发布时间:2017/5/5 16:23:00
--  
If filesys.FileExists(fl)
    Dim idx As Integer = fl.LastIndexOf(".")
    Dim ext As String = fl.SubString(idx)
    Select Case ext
        Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar"
            e.ResponseEncoding = "gb2312" 
            e.WriteFile(fl)
            Return \'这里必须返回
    End Select
End If

--  作者:ap9709130
--  发布时间:2017/5/5 16:24:00
--  
我的代码是这样的!对吗?
--  作者:有点色
--  发布时间:2017/5/5 16:25:00
--  

写在这里

 

e.ResponseEncoding = "gb2312"  \'这里

Select Case e.path    
    Case shfh
        e.ResponseEncoding = "gb2312" \'或者这里
        If e.GetValues.Count > 0 Then
            Dim wb As New WeUI
            wb.Title = "订单编号:" & e.GetValues("id") & ""
            wb.InsertHTML("<h3 align=\'left\' style=\'margin-top:5px\'>客户名称:" & e.GetValues("cid") & "</h3>")
            e.WriteString(wb.Build)
        End If       
End Select

--  作者:ap9709130
--  发布时间:2017/5/5 16:33:00
--  
老师,

试过了,还是乱码?