Functions

decode
I

Decodes the given string value into a string using the provided charset.

encode
I

Encodes the given string value into a string using the provided charset.

decode

function decode(string value, string charset) returns string | Error
Isolated Function

Decodes the given string value into a string using the provided charset.

1string value = "http://www.domain.com/?param1=http%3A%2F%2Fxyz.com%2F%3Fa%3D12%26b%3D55¶m2=99";
2string decoded = check url:decode(value, "UTF-8");

Parameters

  • value string
  • String value to be decoded

  • charset string
  • The name of a supported character encoding

Return Type

(string | Error)

The string value of the decoded string or an url:Error if an error occurred

encode

function encode(string value, string charset) returns string | Error
Isolated Function

Encodes the given string value into a string using the provided charset.

1string value = "param1=http://xyz.com/?a=12&b=55¶m2=99";
2string encoded = check url:encode(value, "UTF-8");

Parameters

  • value string
  • String value to be encoded

  • charset string
  • The name of a supported character encoding

Return Type

(string | Error)

The string value of the encoded string or an url:Error if an error occurred