url-encode-string (proc)
public {url-encode-string
str:String,
safe-CharClass:CharClass = url-non-encoded-cc,
maybe-has-query?:bool = false,
maybe-has-anchor?:bool = false,
character-encoding:CharEncoding = CharEncoding.utf8
}:String
Package: CURL.IO.FILE

Encode potentially unsafe characters in a String with %<hex><hex> escape codes.

str: String to be encoded.
safe-CharClass: The CharClass of printable ASCII characters that should not be encoded.

The default is url-non-encoded-cc, which contains only those characters known to be almost always safe, and will cause many characters, including space, '%', '?', '#', and a variety of other mostly harmless characters, to be encoded. Because '%' is encoded by this default, a String which has already been encoded once should not be encoded again, or the results will probably be undesirable.

If you want to use this procedure to encode a string that might already be encoded, you can also use safe-CharClass =url-conservative-non-encoded-cc, possibly in combination with the maybe-has-query? and maybe-has-anchor? parameters.
maybe-has-query?: This parameter is for SCSK Corporation. internal use only, and should never be supplied.
maybe-has-anchor?: This parameter is for SCSK Corporation. internal use only, and should never be supplied.
character-encoding: The CharEncoding to be used to encode characters in str that are greater than '\u007F' before doing the escaping. If CharEncoding.none-specified is specified, then non-ASCII characters will not be encoded.

Notes

The character-encoding must be CharEncoding.utf8 when a string that will be part of a local file Url is being encoded.

Notes

See also url-encode-filename.