Hi All,

Please can anyone help me.

I have a website where google pics up some links on my site and sends throught the following URL

http://www.globalpropertyonline.net/test.asp?town=gand%EDa

I have one of the URLDecode Functions I found on the net to Decode the %ED

However, this seems not to be working the correct way.

The %ED should be this : í

So when I Decode it the word should be gandía

But instead I get the following word : gand�a

On the page where google gets the link, it is displayed correctly as gandía but it prompts me in webmaster tools that the following link has a error 500 and this is because when I try to take this name and sends it to the MYSQL query it crash with error 500 but if I would have had gandía then it worked !

So, my main problem is that I am getting the %ED sent as URLEncode as it seems and I want to Decode it before I send it to my database query.

In my ASP Page I am using UTF-8 Encodeing as follows.


Code:
<%@ CodePage=65001 Language="VBScript"%> 
<%
Response.CodePage = 65001
Response.CharSet = "utf-8"
This is the Code I am using to Decode it but instead if getting the gandía I get this : gand�a

any help will be much apreciated

Code:
<%@ CodePage=65001 Language="VBScript"%> 
<%
Response.CodePage = 65001
Response.CharSet = "utf-8" 

MyTown = Request("town")

response.write URLDecode(MyTown)


    Function URLDecode(str) 
        str = Replace(str, "+", " ") 
        For i = 1 To Len(str) 
            sT = Mid(str, i, 1) 
            If sT = "%" Then 
                If i+2 < Len(str) Then 
                    sR = sR & _ 
                        Chr(CLng("&H" & Mid(str, i+1, 2))) 
                    i = i+2 
                End If 
            Else 
                sR = sR & sT 
            End If 
        Next 
        URLDecode = sR 
    End Function

%>