STRING::ESCAPE_PATH 1g 2023-11-12 laplante@plcb.ca GOWEB/STRING — Escape Strings for URL Paths


title: “STRING::ESCAPE_PATH” version: “1.0.0” date: 2023-11-12 author: “laplante@plcb.ca” section: “1g” category: “GOWEB/STRING”


Name

string::escape_path Escape Strings for URL Paths

Synopsis

string::escape_path(string)
escape_path(string)
string::escapePath(string)
escapePath(string)

Description

The escape_path function encodes a string so it can be safely included as a segment of a URL path. Characters that are not valid in a URL path segment are replaced with their percent-encoded equivalents.

Key details:

This is particularly useful when inserting dynamic values into a URL:

https://localhost?files={{ escape_path(files) }}

Difference Between escape_path and escape_uri


Parameters


Examples

res={{
    a := { "array" : [1,2,3] };
    escape_path(a);
    escape_path("A long string");
}};

Returns:

res = %!B(MISSING)%!a(MISSING)rray%3A%!B(MISSING)1%!C(MISSING)2%!C(MISSING)3%!D(MISSING)%!D(MISSING)A%!l(MISSING)ong%!s(MISSING)tring

Author


See Also


Version History