ASP tips: Server.URLEncode to the character decompile

Source: Internet
Author: User
Tags chr urlencode
encode|server| Compilation | Tips Here we try to output a paragraph of characters: <%response.write Server.URLEncode ("Dream Shadow")%>, the page displays the result as: %d6%af%c3%ce%bb%c3%d3%b0, the compilation was successful.

What if you decompile it again?
' This function is transferred from the Internet
function UrlDecode (ENCODESTR)
Newstr= ""
Havechar=false
Lastchar= ""
For I=1 to Len (ENCODESTR)
Char_c=mid (encodestr,i,1)
If char_c= "+" then
Newstr=newstr & ""
ElseIf char_c= "%" then
Next_1_c=mid (encodestr,i+1,2)
Next_1_num=cint ("&h" & Next_1_c)
If Havechar Then
Havechar=false
Newstr=newstr & Chr (CInt ("&h" & Lastchar & Next_1_c))
Else
If ABS (next_1_num) <=127 Then
Newstr=newstr & Chr (next_1_num)
Else
Havechar=true
Lastchar=next_1_c
End If
End If
I=i+2
Else
Newstr=newstr & Char_c
End If
Next
Urldecode=newstr
End Function
The final output is decompile to: <%response.write urldecode ("%d6%af%c3%ce%bb%c3%d3%b0")%>

Or: <%response.write UrlDecode (Server.URLEncode ("Dream Shadow")%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.