parseQueryParamsDecoded

fnTuple!(string, string)[] parseQueryParamsDecoded(string q, bool plusAsSpace = false) @safe

Parse a query string into key/value pairs with optional form-style decoding.

Performs the same splitting semantics as parseQueryParams, then applies:

  • If plusAsSpace is true, maps `+` to space (U+0020) before percent-decoding, emulating application/x-www-form-urlencoded behavior.
  • Percent-decodes %HH escapes in both keys and values using pctDecode.

    Parameters

    qQuery string without the leading `?`.
    plusAsSpaceIf true, interpret `+` as space prior to decoding.

    Returns

    Array of decoded (key, value) tuples.

    Examples

    import std.typecons : tuple;
    auto p1 = parseQueryParamsDecoded("q=hello%20world", false);
    assert(p1[0] == tuple("q", "hello world"));
    
    auto p2 = parseQueryParamsDecoded("q=hello+world+%2B&u=%E2%82%AC", true);
    assert(p2[0] == tuple("q", "hello world +"));
    assert(p2[1] == tuple("u", "€"));