Questions tagged [urlencode]

To “URL encode” or “percent encode” text means to encode it for use in a URL. Some characters are not valid when used as-is in URLs, and so much be URL-encoded (percent-encoded) when appearing in URLs.

https://url.spec.whatwg.org/#percent-encoded-bytes is the section of the current URL standard that defines percent encoding (URL encoding).

2314 questions
114
votes
2 answers

Why is curl truncating this query string?

I'm sure the answer to this is going to be some painfully obvious character encoding issue... I'm using curl on the command line to test some endpoints in a python app. The endpoint takes url params of latitude and longitude. Nothing too special. …
DeaconDesperado
  • 9,977
  • 9
  • 47
  • 77
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
102
votes
3 answers

PHP: convert spaces in string into %20?

How can I convert spaces in string into %20? Here is my attempt: $str = "What happens here?"; echo urlencode($str); The output is "What+happens+here%3F", so the spaces are not represented as %20. What am I doing wrong?
matt
  • 42,713
  • 103
  • 264
  • 397
95
votes
3 answers

How to URL encode in Python 3?

I have tried to follow the documentation but was not able to use urlparse.parse.quote_plus() in Python 3: from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'}) I get AttributeError:…
amphibient
  • 29,770
  • 54
  • 146
  • 240
88
votes
11 answers

How do I replace all the spaces with %20 in C#?

I want to make a string into a URL using C#. There must be something in the .NET framework that should help, right?
Haim Bender
  • 7,937
  • 10
  • 53
  • 55
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
81
votes
10 answers

http_build_query() without url encoding

Is there a way to use http_build_query() without having it URL encode according to some RFC standard? Why I don't want to URL encode everything: I'm querying the Ebay API.. They honestly insist on parameter names not being URL encoded, as far as…
Ben G
  • 26,091
  • 34
  • 103
  • 170
81
votes
8 answers

Why should I use urlencode?

I am writing a web application and learning how to urlencode html links... All the urlencode questions here (see tag below) are "How to...?" questions. My question is not "How?" but "Why?". Even the wikipedia article only addresses the mechanics…
augustin
  • 14,373
  • 13
  • 66
  • 79
81
votes
16 answers

How can I URL encode a string in Excel VBA?

Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality?
Matthew Murdoch
  • 30,874
  • 30
  • 96
  • 127
76
votes
5 answers

How to generate url encoded anchor links with AngularJS?

{{address}} generates links that are not url encoded if I understand correctly. What is the proper way to encode #/search?query={{address}}? Example address is 1260 6th…
randomguy
  • 12,042
  • 16
  • 71
  • 101
66
votes
8 answers

urlencoding in Dart

Is there a function to do urlencoding in Dart? I am doing a AJAX call using XMLHttpRequest object and I need the url to be url encoded. I did a search on dartlang.org, but it didn't turn up any results.
Sudar
  • 18,954
  • 30
  • 85
  • 131
61
votes
10 answers

URL-encoded slash in URL

My Map is: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with params new { controller = "Home", action = "Index", id = "" } // Param…
Mathias F
  • 15,906
  • 22
  • 89
  • 159
57
votes
7 answers

How do I encode URI parameter values?

I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input: http://google.com/resource?key=value1 & value2 I expect the…
Gili
  • 86,244
  • 97
  • 390
  • 689
55
votes
12 answers

facebook error 'Error validating verification code'

very strange error. i use gide http://developers.facebook.com/docs/authentication/. so i create request to fb and pass redirect_uri. i use test site on localhost. so if i pass redirect_uri=http://localhost/test_blog/index.php it works fine, but…
kusanagi
  • 14,296
  • 20
  • 86
  • 111
52
votes
3 answers

URL Encoding—Ampersand Problem

I'm having some trouble with some character encoding causing some problems with a search form on my website. One of the possible field values has an ampersand in it. When this is selected and a search is submitted the ampersand is encoded to:…
Vecta
  • 2,312
  • 5
  • 28
  • 47