Note: This website is archived. For up-to-date information about D projects and development, please visit

cashew.cgi -- 0.2.1

Phobos compatible.

Table of Contents

  1. module cashew.cgi.UrlEncode

module cashew.cgi.UrlEncode

This module defines seven functions which provide URL-encoding capabilities. As they all operate on strings and/or arrays of strings, they are suitable for use in most cases as pseudo-members.

  char[] encode (char[] src)
    /* Returns a duplicate of 'src' with non-alphanumeric characters encoded as '%XX' hexadecimal entities. */

  char[] decode (char[] src)
    /* Returns a duplicate of 'src' with '%XX' hexadecimal entities decoded back into characters. */

  char[] encodeQuery (char[][char[]] src, bool escapeGlue = true)
    /* Returns a query string using the keys/values from 'src'.
    If 'escapeGlue' is true, the '&' characters between pairs will be emitted as '&'. */

  char[][char[]] decodeQuery (char[] src)
    /* Given a query string, breaks the key/value pairs apart and returns them in an associative array. */

  char[] encodeArgs (char[][] src)
    /* Encodes the strings in 'src' and returns a single arguments string glued with '+' characters. */

  char[][] decodeArgs (char[][] src)
    /* Returns a duplicate of 'src' with all element strings decoded. */

  char[][] decodeArgs (char[] src)
    /* Splits the argument string in 'src' on the '+' glue, decodes each argument, and returns them as an array. */