Uri-/html- en-/decoding

web::htmlify

web::htmlify ?-options? text

Options: -numeric.

Returns HTML-compliant text with HTML encoded entities in mnemonic form (e.g. &auml;) or in numeric form (e.g. &#228;) if the option -numeric is specified. Multibyte characters are encoded as &#<numeric>;.

web::dehtmlify

web::dehtmlify text

Removes all HTML-tags from text and translates all HTML entities to their corresponding characters (also handles encoded multibyte characters encoded with &#<numeric>;).

web::uriencode

web::uriencode text

Returns URI-compliant text.

web::uridecode

web::uridecode text

Decodes URI-compliant text.

web::list2uri and web::uri2list

web::list2uri list

web::uri2list string

Convert between an even-sized key/value list and a query string. web::list2uri uri-encodes keys and values and returns k1=v1&k2=v2; it raises an error for lists with an odd number of elements. web::uri2list is the inverse and always returns a list with an even number of elements.

Example 16. web::htmlify

% web::htmlify <
&lt;
% web::htmlify -numeric <
&#60;
% web::dehtmlify "&lt; &#60;"
< <
% web::uriencode "Hello, world!"
Hello%2c+world%21
% web::uridecode "Hello%2c+world%21"
Hello, world!
%