Questions tagged [percent-encoding]

Percent-encoding (aka URL encoding) is the way that non-alphabet characters are encoded in URLs and URIs (e.g. spaces turn into %20).

See the full Wikipedia article on the subject: Percent-encoding

83 questions
8
votes
1 answer

Why does Wikipedia use a modified percent encoding in their URL fragments?

I noticed that Wikipedia uses percent encoding for the path section of a URL, but converts the % character to . for the #fragment. For example, on the Russian 'Russia' page, the URL for section 2 (История)…
Deebster
  • 2,829
  • 1
  • 26
  • 26
7
votes
1 answer

How to decode a reserved escape character in a request URI on a web server?

It is pretty clear that a web server has to decode any escaped unreserved character (such as alphanums, etc.) to do the URI comparison. For example, http://www.example.com/~user/index.htm shall be identical to…
J. K. Yip
  • 71
  • 2
7
votes
1 answer

Percent encoding in Ruby

In Ruby, I get the percent-encoding of 'ä' by require 'cgi' CGI.escape('ä') => "%C3%A4" The same with 'ä'.unpack('H2' * 'ä'.bytesize) => ["c3", "a4"] I have two questions: What is the reverse of the first operation? Shouldn't it be ["c3",…
ewi
  • 175
  • 1
  • 9
7
votes
1 answer

Uri.EscapeDataString weirdness

Why does EscapeDataString behave differently between .NET 4 and 4.5? The outputs are Uri.EscapeDataString("-_.!~*'()") => "-_.!~*'()" Uri.EscapeDataString("-_.!~*'()") => "-_.%21~%2A%27%28%29" The documentation By default, the EscapeDataString…
Trevor Merrifield
  • 4,541
  • 2
  • 21
  • 24
7
votes
4 answers

java.net.URI and percent in query parameter value

System.out.println( new URI("http", "example.com", "/servlet", "a=x%20y", null)); The result is http://example.com/servlet?a=x%2520y, where the query parameter value differs from the supplied one. Strange, but this does follow the Javadoc:…
Hontvári Levente
  • 1,242
  • 10
  • 16
6
votes
2 answers

Percent encoding in window.location

When I open a url with special characters using window.location, it seems to percent encode the special characters and then opens the URL. For example var url = "http://gramfeed.com/instagram/tags/kühl"; window.location = url; This will result in…
krisrak
  • 12,882
  • 3
  • 32
  • 46
5
votes
2 answers

How do I convert HTML percent-encoding to Unicode, with XSLT?

There are tons of entries and answers online about this, but they're all going the opposite direction of what I need. From my iTunes XML, I have thousands of percent-encoded entries, in multiple languages, that I'm trying to convert, with an XSLT…
LOlliffe
  • 1,647
  • 5
  • 22
  • 43
5
votes
1 answer

Why is ë percent encoded to %EB but also to %C3%AB?

When I enter ë into a form on my web application, this is percent encoded by Google Chrome to %C3%AB. When I use PHP's urlencode('ë'); This is encoded into %EB. Why are the encodings different? How can I encode with the same encoding as Google…
i.amniels
  • 1,781
  • 1
  • 25
  • 37
4
votes
4 answers

Python requests: URL with percent character

I have been searching all over the place for this, but I couldn't solve my issue. I am using a local API to fetch some data, in that API, the wildcard is the percent character %. The URL is like so : urlReq =…
Elie
  • 337
  • 3
  • 6
  • 14
4
votes
2 answers

Is '|' a recommended separator for semantic URLs?

After researching Google and SO, there seems to be conflicting opinions on this. We have run-in to a problem with Google Chrome substituting | separator as %7C, whereas Firefox and Safari do not. Here's an…
Richard Tinkler
  • 1,635
  • 3
  • 21
  • 41
4
votes
1 answer

Why does Uri behave differently for different schemes?

While poking around with the Uri class answering another question, I found something that seems strange to me: Consider these two Uris: var u1 = new Uri("http://a.b:33/abc%2fdef/c?d=f"); var u2 = new Uri("foobar://a.b:33/abc%2fdef/c?d=f"); They…
spender
  • 117,338
  • 33
  • 229
  • 351
4
votes
2 answers

non-ascii email addresses and SMTP

Is there any way that this email will ever function? łōręmıpśum@łōręmıpśum.com This is not a totally frivolous pursuit. We have Polish users who have input non-ascii emails into our app. The gmail validator flags it as invalid, but maybe it's just…
bukzor
  • 37,539
  • 11
  • 77
  • 111
3
votes
2 answers

Percent-encoding of every utf-8 character with c#

I would like to prepare a string for to put it into a "post" request. Unfortunately all the methods I found to encode an url seem to apply percent-encoding only to a handful of characters. The various methods, eg. HttpUtility.UrlEncode, leave…
user1046221
  • 81
  • 1
  • 8
3
votes
2 answers

mod_rewrite rule to enforce canonical percent-encoding

We have a PHP app with a dynamic URL scheme which requires characters to be percent-encoded, even "unreserved characters" like parentheses or aphostrophes which aren't actually required to be encoded. URLs which the app deems to be encoded the…
Justin Grant
  • 44,807
  • 15
  • 124
  • 208
3
votes
2 answers

Asterisk (*) not allowed in Status Update

I'm trying to use the Twitter v1.1 API endpoint: POST : https://api.twitter.com/1.1/statuses/update.json?status=%2A -or- POST : https://api.twitter.com/1.1/statuses/update.json?status=* After seeing some suggestions about URL Encoding (percent…
Ian Tunbridge
  • 172
  • 2
  • 14