-2

I wanted to send special characters in URI WITHOUT encoding it. Is that possible in Firefox or chrome browser. Example:

http://www.exampple.com/?a=somespecialcharacters>;

Any idea?

Thank you

Sagar
  • 1
  • 2
  • `encodeURI('http://www.exampple.com/?a=somedata>; ')` and `encodeURIComponent('fdsklafds$#@%$3')` – Tushar Aug 25 '15 at 06:59
  • Hi encodeURI will encode it. I wanted to send it without encoding it – Sagar Aug 25 '15 at 07:00
  • moreover browser mostly encode any special characters by default. You can see that in HTTP request. In my case i need to send unenocded string to server. – Sagar Aug 25 '15 at 07:10
  • 1
    Without encoding it? Impossible, as some characters cannot survive without encoding (e.g. `%`, `+` and `#`). – Amadan Aug 25 '15 at 07:16
  • I specially need to use >, < , ; . by the way IE by default won't encoded it. but I am looking to work it on Firefox or chrome – Sagar Aug 25 '15 at 07:22
  • @EricLease. so is that impossible to pass < and > in URI apart from IE? – Sagar Aug 25 '15 at 07:31

2 Answers2

2

The reason certain characters need to be encoded is because they already have a behavior defined for them. If they're not encoded, they'll be intepretted with the default behavior. By encoding them you are essentially hiding them so their default behavior isn't used. That "default behavior" is something that might be triggered by the client or server, and is beyond the scope of the application running in either the client or on the server. You don't have a choice but to encode on the client, and decode on the server.

I'm not saying it's impossible, but it's not a good idea. This is what we call code smell in the business. It breaks convention, and actually in the case of angled brackets it goes against URI syntax.

Angle brackets aren't even reserved, they're disallowed. IE should not allow them, and you should not do something just because IE allows it. In fact, if something only works in IE, IE probably has it implemented incorrectly (according to everyone that is not paid by MS). Here's an in depth analysis of other MS quirky behavior surrounding URIs..

Community
  • 1
  • 1
Eric Lease
  • 4,114
  • 1
  • 29
  • 45
1

Without encoding: you really don't know what and how the browser interprets it. It's terrible for your users.

Characters as / and & can make the link very aberrant.

Compare:

http://foo.com/this/is/my/parameter vs. http://foo.com/this%2Fis%2Fmy%2Fparameter

schellingerht
  • 5,726
  • 2
  • 28
  • 56