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
931
votes
5 answers

URL encoding the space character: + or %20?

When is a space in a URL encoded to +, and when is it encoded to %20?
BC.
  • 24,298
  • 12
  • 47
  • 62
419
votes
11 answers

urlencode vs rawurlencode?

If I want to create a URL using a variable I have two choices to encode the string. urlencode() and rawurlencode(). What exactly are the differences and which is preferred?
Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199
396
votes
11 answers

How to do URL decoding in Java?

In Java, I want to convert this: https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type To this: https://mywebsite/docs/english/site/mybook.do&request_type This is what I have so far: class StringUTF { public static void…
crackerplace
  • 5,305
  • 8
  • 34
  • 42
163
votes
13 answers

Sharing a URL with a query string on Twitter

I'm trying to put a Twitter share link in an email. Because this is in an email I can't rely on JavaScript, and have to use the "Build Your Own" Tweet button. For example, sharing a link to Google:
haydenmuhl
  • 5,998
  • 7
  • 27
  • 32
160
votes
3 answers

URL: Username with @

To send username and password with a URL, we use this scheme: http://username:password@www.my_site.com But my username is my_email@gmail.com. The problem is the @. How can I solve it?
Rodrigo
  • 11,909
  • 23
  • 68
  • 101
146
votes
6 answers

A html space is showing as %2520 instead of %20

Passing a filename to the firefox browser causes it to replace spaces with %2520 instead of %20. I have the following HTML in a file called myhtml.html: When I load myhtml.html into…
Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
146
votes
5 answers

In a URL, should spaces be encoded using %20 or +?

In a URL, should I encode the spaces using %20 or +? For example, in the following example, which one is correct? www.mydomain.com?type=xbox%20360 www.mydomain.com?type=xbox+360 Our company is leaning to the former, but using the Java method…
MegaByter
  • 1,461
  • 2
  • 9
  • 3
90
votes
12 answers

NameValueCollection to URL Query?

I know i can do this var nv = HttpUtility.ParseQueryString(req.RawUrl); But is there a way to convert this back to a url? var newUrl = HttpUtility.Something("/page", nv);
user34537
89
votes
9 answers

Copying a UTF-8 URL from browser's address bar, gives only the ugly encoded one

When I copy a UTF-8 URL from the browser's address bar (almost any browser on any os), then try to paste it in another text field (to post it on facebook or twitter for example), it gives only the decoded URL, which makes it ugly. For example, in…
AbdelHady
  • 9,334
  • 8
  • 56
  • 83
83
votes
1 answer

How to encode URL in Groovy?

Is there a kind of URLEncode in Groovy? I can't find any String → String URL encoding utility. Example: dehydrogenase (NADP+) → dehydrogenase%20(NADP%2b) (+ instead of %20 would also be acceptable, as some implementations do that)
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
75
votes
13 answers

urlencoded Forward slash is breaking URL

About the system I have URLs of this format in my project:- http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0 Where keyword/class pair means search with "class" keyword. I have a common…
Sandeepan Nath
  • 9,966
  • 17
  • 86
  • 144
68
votes
9 answers

How to find out if string has already been URL encoded?

How could I check if string has already been encoded? For example, if I encode TEST==, I get TEST%3D%3D. If I again encode last string, I get TEST%253D%253D, I would have to know before doing that if it is already encoded... I have encoded…
Trick
  • 3,779
  • 12
  • 49
  • 76
49
votes
3 answers

URL encoding/decoding with Python

I am trying to encode and store, and decode arguments in Python and getting lost somewhere along the way. Here are my steps: 1) I use google toolkit's gtm_stringByEscapingForURLArgument to convert an NSString properly for passing into HTTP…
Joey
  • 7,537
  • 12
  • 52
  • 104
41
votes
5 answers

How to encode URL to avoid special characters in Java?

i need java code to encode URL to avoid special characters such as spaces and % and & ...etc
Adham
  • 63,550
  • 98
  • 229
  • 344
39
votes
5 answers

GETting a URL with an url-encoded slash

I want to send a HTTP GET to http://example.com/%2F. My first guess would be something like this: using (WebClient webClient = new WebClient()) { webClient.DownloadData("http://example.com/%2F"); } Unfortunately, I can see that what is actually…
Rasmus Faber
  • 48,631
  • 24
  • 141
  • 189
1
2 3
66 67