Decode URL string

S

Snedker

As part of URL I have ie:

www.website.com?test=%F8%E5%C6%D8%C5

Requesting the querystring and displaying the content on web I just
get a bunch of squares instead of the special Danish characters that I
expect. But I don't know how to decode them properly. Do you?

Any help or pointer in the right direction is greatly appreciated -
thanks in advance!


Kind regards /Snedker
 
F

Florian Paulus

Snedker said:
As part of URL I have ie:

www.website.com?test=%F8%E5%C6%D8%C5

Requesting the querystring and displaying the content on web I just
get a bunch of squares instead of the special Danish characters that I
expect. But I don't know how to decode them properly. Do you?

Any help or pointer in the right direction is greatly appreciated -
thanks in advance!


Kind regards /Snedker

How are you trying to decode them?
 
S

Snedker

How are you trying to decode them?

Using System.Web.SystemHttpUtility.UrlDecode is what I've tried, but
not with the result of "squares"...

Regards /Snedker
 
S

Snedker

Using System.Web.SystemHttpUtility.UrlDecode is what I've tried, but
not with the result of "squares"...

Regards /Snedker

...but WITH the result of squares, that is... :)
/snedker
 
F

Florian Paulus

Snedker said:
..but WITH the result of squares, that is... :)
/snedker
Did you try to set the default encodings to utf-8 in your web.config?

<configuration>
<system.web>
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8" />
</system.web>
</configuration>
 
S

Snedker

Did you try to set the default encodings to utf-8 in your web.config?

<configuration>
    <system.web>
       <globalization
          requestEncoding="utf-8"
          responseEncoding="utf-8" />
    </system.web>
</configuration>- Skjul tekst i anførselstegn -

- Vis tekst i anførselstegn -

Those exact settings are already set.

Thx for input and efforts!

Regards /Snedker
 
S

Snedker

Hi Snedker,

Would you try System.Web.HttpUtility.UrlDecode?

Already tried that:

Dim s As String = HttpContext.Current.Request("test")
s = HttpUtility.UrlDecode(s, Encoding.UTF8)
s = HttpUtility.HtmlDecode(s)

and the s= lines in reverse order as well. Still no luck.

regards /Snedker
 
F

Florian Paulus

Snedker said:
Already tried that:

Dim s As String = HttpContext.Current.Request("test")
s = HttpUtility.UrlDecode(s, Encoding.UTF8)
s = HttpUtility.HtmlDecode(s)

and the s= lines in reverse order as well. Still no luck.

regards /Snedker

Are you using firefox ? I did some testing and found that i get the same
problems as you describe unless i set in firefox about:config the
encoding for outgoing request to use unicode to true, the default was false.

After this it works nicely, else seems that the real querystring is
autoconverted into some strange %u..... format and that results into
those squares.

Look at it in the debugger, then u see what i mean. Thats the problem
but i dont know how to solve it, you would somehow need to find out the
original encoding of the client sending the request and decode it
yourself. All the builtin methods like urldecode and so on fail with the
same unwanted result.

Using POST however instead of GET it seems to work without any problems.

Regards

Florian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top