Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Decode URL string

Reply
Thread Tools

Decode URL string

 
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
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
 
Reply With Quote
 
 
 
 
Florian Paulus
Guest
Posts: n/a
 
      09-01-2008
Snedker wrote:
> 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?
 
Reply With Quote
 
 
 
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:
> Snedker wrote:
> > 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?


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

Regards /Snedker
 
Reply With Quote
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
On 1 Sep., 14:32, Snedker <(E-Mail Removed)> wrote:
> On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:
>
> > Snedker wrote:
> > > 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?

>
> 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
 
Reply With Quote
 
Florian Paulus
Guest
Posts: n/a
 
      09-01-2008
Snedker wrote:
> On 1 Sep., 14:32, Snedker <(E-Mail Removed)> wrote:
>> On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:
>>
>>> Snedker wrote:
>>>> 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?

>> 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

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>
 
Reply With Quote
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
On 1 Sep., 14:54, Florian Paulus <(E-Mail Removed)> wrote:
> Snedker wrote:
> > On 1 Sep., 14:32, Snedker <(E-Mail Removed)> wrote:
> >> On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:

>
> >>> Snedker wrote:
> >>>> 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?
> >> 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

>
> 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
 
Reply With Quote
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
On 1 Sep., 15:38, Snedker <(E-Mail Removed)> wrote:
> On 1 Sep., 14:54, Florian Paulus <(E-Mail Removed)> wrote:
>
>
>
>
>
> > Snedker wrote:
> > > On 1 Sep., 14:32, Snedker <(E-Mail Removed)> wrote:
> > >> On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:

>
> > >>> Snedker wrote:
> > >>>> 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?
> > >> 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

>
> > 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!


Hope that last sentence wasn't read as "problem solved"...

regards /snedker
 
Reply With Quote
 
Coskun SUNALI [MVP]
Guest
Posts: n/a
 
      09-01-2008
Hi Snedker,

Would you try System.Web.HttpUtility.UrlDecode?

--
All the best,
Coskun SUNALI
MVP ASP/ASP.NET
http://sunali.com
http://www.propeople.dk

"Snedker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On 1 Sep., 14:14, Florian Paulus <(E-Mail Removed)> wrote:
>> Snedker wrote:
>> > 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?

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


 
Reply With Quote
 
Snedker
Guest
Posts: n/a
 
      09-01-2008
On 1 Sep., 16:43, "Coskun SUNALI [MVP]" <(E-Mail Removed)> wrote:
> Hi Snedker,
>
> Would you try System.Web.HttpUtility.UrlDecode?
>
> --
> All the best,
> Coskun SUNALI


Already tried that:

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

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

regards /Snedker
 
Reply With Quote
 
Florian Paulus
Guest
Posts: n/a
 
      09-02-2008
Snedker wrote:
> On 1 Sep., 16:43, "Coskun SUNALI [MVP]" <(E-Mail Removed)> wrote:
>> Hi Snedker,
>>
>> Would you try System.Web.HttpUtility.UrlDecode?
>>
>> --
>> All the best,
>> Coskun SUNALI

>
> Already tried that:
>
> Dim s As String = HttpContext.Current.Request("test")
> s = HttpUtility.UrlDecode(s, Encoding.UTF
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How encode & decode string to integer and back to string? sumit Java 0 03-10-2012 10:17 AM
how to convert url with query string to url without query string nick Javascript 1 02-13-2011 11:20 PM
URL Decode HTML encoded in JavaScript Ben Amada ASP .Net 1 09-30-2005 08:25 AM
uencode decode url string Xah Lee Perl Misc 1 06-27-2005 10:33 AM
function to url decode a string Ramprasad A Padmanabhan C Programming 11 07-27-2003 04:23 AM



Advertisments