You are not logged in.

#1 2010-08-11 10:18:21

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

how to encode an exclamation mark in an url?

I have been trying to encode an ! in an url, but somehow it just doesn't work.

I tried RFC1738 codes -- one website mentioned the code was %21, a couple others said it was %22. However, both don't do any good.

Any pointers?


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#2 2010-08-11 10:48:41

bobdob
Member
Registered: 2008-06-13
Posts: 138

Re: how to encode an exclamation mark in an url?

I get it as %21 using perl's uri encoder

$ echo -n '!' | perl -MURI::Escape -le 'print uri_escape <STDIN>'
%21

Offline

#3 2010-08-11 10:48:50

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: how to encode an exclamation mark in an url?

Can you encode "~", "#", "?" etc.?

Offline

#4 2010-08-11 11:21:56

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: how to encode an exclamation mark in an url?

Nevermind, misunderstood.

Last edited by Ramses de Norre (2010-08-11 11:23:48)

Offline

#5 2010-08-11 11:24:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: how to encode an exclamation mark in an url?

Ramses de Norre wrote:

I don't think you use html escape codes in urls.

Offline

#6 2010-08-11 11:25:09

Ramses de Norre
Member
From: Leuven - Belgium
Registered: 2007-03-27
Posts: 1,289

Re: how to encode an exclamation mark in an url?

karol wrote:
Ramses de Norre wrote:

I don't think you use html escape codes in urls.

You don't, I misread the question smile

Offline

#7 2010-08-11 21:41:37

Proofrific
Member
Registered: 2008-01-05
Posts: 215

Re: how to encode an exclamation mark in an url?

bobdob wrote:

I get it as %21 using perl's uri encoder

$ echo -n '!' | perl -MURI::Escape -le 'print uri_escape <STDIN>'
%21

I agree with %21.  You can also look it up at http://www.w3schools.com/tags/ref_urlencode.asp or use their "Try It Yourself" form.

Offline

Board footer

Powered by FluxBB