Decode URL string

  • Thread starter Thread starter Snedker
  • Start date Start date
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
 
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?
 
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
 
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
 
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>
 
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
 
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
 
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
 
Back
Top