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
39
votes
4 answers

How do you unescape URLs in Java?

When I read the xml through a URL's InputStream, and then cut out everything except the url, I get "http://cliveg.bu.edu/people/sganguly/player/%20Rang%20De%20Basanti%20-%20Tu%20Bin%20Bataye.mp3". As you can see, there are a lot of "%20"s. I want…
Penchant
  • 1,165
  • 7
  • 19
  • 28
38
votes
2 answers

URL encoding on Django Template

I have this anchor link: {{title}} Sometimes, this title has some content with + (add operator) like: "Django + Python" But when it is directly placed on anchor links, the url delivered will…
jdtoh
  • 1,697
  • 2
  • 13
  • 18
36
votes
2 answers

How to URL encode periods?

I need to URL encode some periods since I have to pass some document path along and it is like this http://example.com/test.aspx?document=test.docx So test.docx is causing me an error of an illegal character. So I need to change it to . --> …
chobo2
  • 83,322
  • 195
  • 530
  • 832
35
votes
2 answers

Why is the return value of String.addingPercentEncoding() optional?

The signature of the String method for percent-escaping is: func addingPercentEncoding(withAllowedCharacters: CharacterSet) -> String? (This was stringByAddingPercentEncodingWithAllowedCharacters in Swift 2.) Why does this method return an…
Paul Cantrell
  • 9,175
  • 2
  • 40
  • 48
35
votes
1 answer

When should an asterisk be encoded in an HTTP URL?

According to RFC1738, an asterisk (*) "may be used unencoded within a URL": Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL. However,…
Riley Major
  • 1,904
  • 23
  • 36
35
votes
2 answers

How to decode url-encoded string in javascript

I use javascript / jquery to fill dom elements that contain umlauts: var text1 = "Unser platonisches Internetreich droht in die H%E4nde einer bewaffneten Miliz zu fallen." $("#quote1 span").html(unescape(text1)); How can I get rid of the url…
Michael Schmidt
  • 423
  • 1
  • 4
  • 6
34
votes
1 answer

Do ampersands still need to be encoded in URLs in HTML5?

I learned recently (from these questions) that at some point it was advisable to encode ampersands in href parameters. That is to say, instead of writing: ... One should write:
doppelgreener
  • 4,809
  • 10
  • 46
  • 63
32
votes
3 answers

What is the encoding of Chinese characters on Wikipedia?

I was looking at the encoding of Chinese characters on Wikipedia and I'm having trouble figuring out what they are using. For instance "的" is encoded as "%E7%9A%84" (see here). That's three bytes, however none of the encodings described on this page…
laurent
  • 88,262
  • 77
  • 290
  • 428
28
votes
10 answers

iOS : How to do proper URL encoding?

I'm unable to open a URL into UIWebView so I've seached & found that I need to encode URL, so I tried to encode it but, I've facing problem in URL encoding : My URL is http://somedomain.com/data/Témp%20Page%20-%20Open.html (It's not real URL). I'm…
Hemang
  • 26,840
  • 19
  • 119
  • 186
26
votes
1 answer

Is URL percent-encoding case sensitive?

Is %3B treated differently to %3b in an URL?
hugomg
  • 68,213
  • 24
  • 160
  • 246
26
votes
13 answers

Test if string is URL encoded in PHP

How can I test if a string is URL encoded? Which of the following approaches is better? Search the string for characters which would be encoded, which aren't, and if any exist then its not encoded, or Use something like this which I've…
Psytronic
  • 6,043
  • 5
  • 37
  • 56
23
votes
4 answers

URL component encoding in Node.js

I want to send http request using node.js. I do: http = require('http'); var options = { host: 'www.mainsms.ru', path: '/api/mainsms/message/send?project='+project+'&sender='+sender+'&message='+message+'&recipients='+from+'&sign='+sign …
Kliver Max
  • 5,107
  • 22
  • 95
  • 148
22
votes
1 answer

Can urls have UTF-8 characters?

I was curious if I should encode urls with ASCII or UTF-8. I was under the belief that urls cannot have non-ASCII characters, but someone told me they can have UTF-8, and I searched around and couldn't quite find which one is true. Does anyone know?
Popcorn
  • 5,188
  • 12
  • 54
  • 87
21
votes
4 answers

Using Perl, how do I decode or create those %-encodings on the web?

I need to handle URI (i.e. percent) encoding and decoding in my Perl script. How do I do that? This is a question from the official perlfaq. We're importing the perlfaq to Stack Overflow.
perlfaq
  • 1,361
  • 4
  • 15
  • 23
19
votes
3 answers

Java URL param replace %20 with space

In my web page when form is submitted witha space entered in text field, it is being read as %20 in backend java code instead of space. I can replace %20 back to "" in backend but i think it is not the right approach and it could happen anywhere in…
McQueen
  • 460
  • 2
  • 9
  • 20
1
2
3
66 67