url encode

From Onset Developer Wiki
url encode

Type: Function
Context: Server
Introduced: v1.0.3

Description

Encodes your string so it is safe to send with an URL.

Syntax

url_encode(str)

Parameters

  • str
    The string to encode.

Return Value

  • Returns the encoded string.

Example

local body = ""
body = body.."foo1="..url_encode("bar?")
body = body.."foo2="..url_encode("?d,_:%bar2?")

http_set_body(r, body)
http_set_field(r, "content-length", string.len(body))
http_set_field(r, "content-type", "application/x-www-form-urlencoded; charset=utf-8")

See also