Questions tagged [url-encoding]

URL Encoding is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances.

URL Encoding, also known as Percent-encoding, is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. Although it is known as URL encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN).

As such, it is also used in the preparation of data of the application/x-www-form-urlencoded media type, as is often used in the submission of HTML form data in HTTP requests.

1000 questions
17
votes
4 answers

jQuery's $.ajax URL Encoding Problems

I'm using jQuery's $.ajax method to send and retrieve data to a REST service. Some of the URL's I'm providing to the $.ajax method requires spaces and other special characters to be encoded. The problem lies with Chrome, Safari (Webkit) and Internet…
user151419
17
votes
4 answers

How to encode + into %2B with NSURLComponents

I'm using NSURLComponents and I can't seem to get the query values to encode correctly. I need the final URL to represent a + as %2B. let baseUrl = NSURL(string: "http://www.example.com") let components = NSURLComponents(URL: baseUrl,…
Col
  • 2,300
  • 3
  • 16
  • 16
17
votes
4 answers

Percentage Encoding of special characters before sending it in the URL

I need to pass special characters like #,! etc in URL to Facebook,Twitter and such social sites. For that I am replacing such characters with URL Escape Codes. return valToEncode.Replace("!", "%21").Replace("#", "%23") .Replace("$",…
Priya
  • 1,375
  • 8
  • 21
  • 45
16
votes
2 answers

mod_rewrite NE flag - When is it helpful to encode special chars in the URL?

I've been looking at the [NE] (noescape) flag in mod_rewrite. After some thought I couldn't figure out a situation when I would NOT want to use the flag. Meaning, it seems most helpful to keep the flag enabled in almost every RewriteRule. Not…
Vahid Pazirandeh
  • 1,552
  • 3
  • 13
  • 29
16
votes
3 answers

Uri.AbsoluteUri vs. Uri.OriginalString

I recently became aware of the odd behavior of Uri.ToString() (namely, it unencodes some characters and therefore is primarily suitable for display purposes). I'm trying to decide between AbsoluteUri and OriginalString as my "go-to" for converting a…
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
16
votes
2 answers

Escape | (vertical bar/pipe) in URL in Wiki Markup Template

Is it possible to escape and keep the nonstandard | character as is in an URL in a template Wiki Markup within a table? {| class="wikitable" |- ! Test in Table |- | [http://example.org/{var1}|{var2}|{var3} Example] |} Should render something like…
mxfh
  • 386
  • 1
  • 2
  • 11
15
votes
4 answers

Angular 4 - Route query params cause path match failure

After searching multiple threads/questions on the various types of routing within Angular 4, I cannot resolve an issue linked to passing queryParams to an Angular 4 route. When passing either into the url http://localhost/search;x=y through the…
soulofahero
  • 271
  • 1
  • 2
  • 7
15
votes
2 answers

Rails url helper not encoding ampersands

So I'm trying to use a Rails URL helper (page_url) to create URLs that contain special characters, including ampersands. Most cases work like you'd expect them to: (rdb:1) page_url('foo', :host => 'host') "http://host/pages/foo" (rdb:1)…
lambshaanxy
  • 22,552
  • 10
  • 68
  • 92
15
votes
3 answers

How to URL encode strings in C#

How can we encode a string using the URL (RFC 1738) standard in C#? The following online tool is converting the strings using this standard http://www.freeformatter.com/url-encoder.html An example of the string I want to convert is test(brackets)…
rumi
  • 3,293
  • 12
  • 68
  • 109
15
votes
2 answers

java.net.URLEncoder.encode encodes space as + but I need %20

As the title says: which encoder would give me space as %20 as opposed to +? I need it for android. java.net.URLEncoder.encode gives +
Cote Mounyo
  • 13,817
  • 23
  • 66
  • 87
14
votes
0 answers

Why do request parameters sent in request body need to be URL encoded?

I understand with GET request they need to be entered into a URL and therefore need to be URL (percent) encoded so that they don't mean anything in the context of a server interpreting the URL. But if data is in the body of a request rather than the…
14
votes
6 answers

How to get params for url with whitespace as '%20' instead of '+' in Rails

If I have this params for adding to the URL params = { name: 'John Key' } and use the method to_param: params.to_param => "name=John+Key" The point is that '+' is not correctly read by the service used and is needed '%20' instead name=John%20Key:…
AlexLarra
  • 841
  • 5
  • 18
14
votes
3 answers

What is the behavior of Hash(#) in query string

I am sending the below url with query string. In the query string one parameter "approverCmt" has value with hash(#). "/abc/efd/xyz.jas?approverCmt=Transaction Log #459505&batchNm=XS_10APR2015_082224&mfrNm=Timberland" In server side…
Shekhar Khairnar
  • 2,643
  • 3
  • 26
  • 44
14
votes
3 answers

How to correctly encode MailTo links in ASP.NET MVC?

I have the following mailto link on an ASP.NET MVC 5 application: share by email This is…
Miguel Moura
  • 36,732
  • 85
  • 259
  • 481
14
votes
3 answers

how do i decode/encode the url parameters for the new google maps?

Im trying to figure out how to extract the lat/long of the start/end in a google maps directions link that looks like…
laserpanda
  • 367
  • 1
  • 3
  • 10
1 2
3
66 67