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
106
votes
19 answers

Encode/Decode URLs in C++

Does anyone know of any good C++ code that does this?
user126593
  • 2,707
  • 4
  • 21
  • 16
82
votes
7 answers

How to prevent python requests from percent encoding my URLs?

I'm trying to GET an URL of the following format using requests.get() in python: http://api.example.com/export/?format=json&key=site:dummy+type:example+group:wheel #!/usr/local/bin/python import requests print(requests.__versiom__) url =…
Satyen Rai
  • 1,493
  • 1
  • 12
  • 19
27
votes
4 answers

Percent encoding javascript

Is there a javascript function that takes a string and converts it into another string that is percent-encoded? That way something like "This Guy" turns into "This%20Guy". Thanks
locoboy
  • 38,002
  • 70
  • 184
  • 260
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
23
votes
3 answers

Python argparse errors with '%' in help string

I have a default value that contains a '%' which I also insert in to the help doc of my argument. E.g.: default = "5% foo" animrender_group.add_argument( "--foo", default=default, help="Foo amount. Default: %s" % default, ) args =…
Rafe
  • 1,937
  • 22
  • 31
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
23
votes
1 answer

Changing "/" to "%2f" in URL doesn't work

I have an orchard site and have the following problem: If I use the URL: http://asiahotelct.com/tours/ct---chau-%C4%91oc---ha-tien-3n2%C4%91, it's okay. But when I change url the / to %2f (like so:…
user1796655
  • 231
  • 1
  • 2
  • 3
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
4 answers

NSString URL decode?

I have tried a lot of approaches out there, but this tiny little string just cannot be URL decoded. NSString *decoded; NSString *encoded = @"fields=ID%2CdeviceToken"; decoded = (__bridge…
Geri Borbás
  • 15,810
  • 18
  • 109
  • 172
13
votes
1 answer

When, if ever, should characters like { and } (curly braces) be percent-encoded in URLs?

According to RFC 3986 the following characters are reserved and need to be percent-encoded in order to be used in a URI other than as their reserved uses: :/?#[]@!$&'()*+,;= Furthermore it specifies some characters that are specifically unreserved:…
jacobq
  • 11,209
  • 4
  • 40
  • 71
12
votes
1 answer

Why does Apache Tomcat handle encoded slashes (%2F) as path separators?

Apache Tomcat (at least before Tomcat 6 see footnote) treats a percent-encoded slash (%2F) in a URI path just like a regular slash (i.e. as a path delimiter). So e.g. the servlets example page of Tomcat can be accessed at…
sleske
  • 81,358
  • 34
  • 189
  • 227
10
votes
1 answer

Use character # in URL inside file name

I need to put a link with this href="file://attachments/aaaa_#_aaaa.msg" Obviously in that way is not working because the hash character # is used for anchors. So I try to change this to: href="file://attachments/aaaa_%23_aaaa.msg" but when I open…
ajimenez
  • 175
  • 2
  • 14
9
votes
2 answers

How to percent encode in Java?

How do I do percent encoding of a string, as described in RFC 3986? I.e. I do not want (IMO, weird) www-url-form-encoded, as that is different. If it matters, I am encoding data that is not necessarily an entire URL.
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
9
votes
1 answer

Avoid percent-encoding href attributes when using PHP's DOMDocument

The best answers I was able to find for this issue are using XSLT, but I'm just not sure how to apply those answers to my problem. Basically, DOMDocument is doing a fine job of escaping URLs (in href attributes) that are passed in, but I'm actually…
anonymous coward
  • 12,594
  • 13
  • 55
  • 97
8
votes
2 answers

Normalising possibly encoded URI strings in Java

Using Java, I want to strip the fragment identifier and do some simple normalisation (e.g., lowercase schemes, hosts) of a diverse set of URIs. The input and output URIs should be equivalent in a general HTTP sense. Typically, this should be…
badroit
  • 1,316
  • 15
  • 28
1
2 3 4 5 6