github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/urlencode.html.md (about) 1 --- 2 layout: "language" 3 page_title: "urlencode - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-encoding-urlencode" 5 description: |- 6 The urlencode function applies URL encoding to a given string. 7 --- 8 9 # `urlencode` Function 10 11 `urlencode` applies URL encoding to a given string. 12 13 This function identifies characters in the given string that would have a 14 special meaning when included as a query string argument in a URL and 15 escapes them using 16 [RFC 3986 "percent encoding"](https://tools.ietf.org/html/rfc3986#section-2.1). 17 18 The exact set of characters escaped may change over time, but the result 19 is guaranteed to be interpolatable into a query string argument without 20 inadvertently introducing additional delimiters. 21 22 If the given string contains non-ASCII characters, these are first encoded as 23 UTF-8 and then percent encoding is applied separately to each UTF-8 byte. 24 25 ## Examples 26 27 ``` 28 > urlencode("Hello World") 29 Hello%20World 30 > urlencode("☃") 31 %E2%98%83 32 > "http://example.com/search?q=${urlencode("terraform urlencode")}" 33 http://example.com/search?q=terraform+urlencode 34 ```