 
 : decode-uri ( str -- decoded )
     [ 0 swap [ escape-uri-char? ] decode-uri-iter ] "" make utf8 decode ;
-
-: url-decode ( str -- decoded )
-    [ 0 swap url-decode-iter ] "" make utf8 decode ;
-
-: query-decode ( str -- decoded )
-    "+" split "%20" join url-decode ;
-
-: query>assoc ( query -- assoc )
-    dup [
-        "&;" split <linked-hash> [
-            [
-                [ "=" split1 [ dup [ query-decode ] when ] bi@ swap ] dip
-                add-query-param
-            ] curry each
-        ] keep
-    ] when ;
-
-: assoc>query ( assoc -- str )
-    [
-        [
-            [ url-encode-full ] dip [
-                dup array? [ 1array ] unless
-                [ url-encode-full "=" glue , ] with each
-            ] [ , ] if*
-        ] assoc-each
-    ] { } make "&" join ;


PRIVATE>

: escape-uri-component-char? ( ch -- ? )
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~*'()" member? not ; inline

: encode-uri-component ( str -- str' )
    [

    ] "" make ;

: escape-uri-char? ( ch -- ? )
    {
        [ letter? ]
        [ LETTER? ]
        [ digit? ]
        [ ";,/?:@&=+$-_.!~*'()#" member? ]
    } 1|| not ; foldable

: encode-uri ( str -- str' )
    [
