[Function] percent-encode

Package

ystok.uri

Signature

percent-encode string &key external-format safe unsafe => result-string

Arguments
string
A simple string, usually representing a component of a URI.
external-format
An external format designator; defaults to the value of *default-external-format*.
safe
A simple array of the bit type and of the length of 127 or nil.
unsafe
A simple array of the bit type and of the length of 127 or nil.
Values

A string with all "unsafe" (i.e. reserved or non-ASCII) characters replaced by escape sequences.

Description

This function converts uri object to a string and if stream in not null, write the result string there with the Common Lisp function write-string.

external-format is either :utf-8 or a designator of an arbitrary external format in accordance to your Lisp implementation or flexi-streams specification.

safe is a bitmask of characters with code in the range [0..126] that may not be escaped. If is nil, all characters in this range are considered safe. By default, all unreserved characters are considered "safe".

unsafe is an additional bitmask of characters with code in the range [0..126] that must be escaped. The default is nil than means that none of the characters in this range is considered "unsafe".