Hi,

Its me again :)
First of, Chris thank you for trying. It worked for the script I
supplied, but since it wasnt so complex as the REAL one and I am
not as smart as I tought it didnt work :(

So if anybody could help me abit with this, then maybe I'll get
somewhere :)

REBOL [
  Title: "Strange."
  File: %"Strange.r"
  Author: "Pedro Tumusok"
  eMail: [EMAIL PROTECTED]
  ]

url-encode: func [
    {URL-encode a string}
    data "String to encode"
    /local new-data
][
    new-data: make string! ""
    normal-char: charset [
        #"A" - #"Z" #"a" - #"z"
        #"@" #"." #"*" #"-" #"_"
        #"0" - #"9"
    ]
    if not string? data [return new-data]
    forall data [
        append new-data either find normal-char first data [
            first data
        ][
            rejoin ["%" to-string skip tail (to-hex to-integer
first data) -2]
        ]
    ]
    new-data
]

my-func: func [
  arg [block!]
  ]
[
  encoded-data: make string! ""
    foreach [name value] arg [
        append encoded-data rejoin [
            url-encode name "=" url-encode value ";"
        ]
    ]
  print ["Encoded: "encoded-data]
]

my-func ["test" "test2"]

--
With kind regards

    Jan Pedro Tumusok - ZyXEL Communications AS
    Molleparken 4 - N-0459 Oslo - Norway
    Phone (+47) 22 80 61 80 - Fax (+47) 22 80 61 81
    Did you visit www.zyxel.no today ?

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 17, 2000 12:25 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Problem with passing arguments to a
> function Re:
>
>
> word!s in a block! aren't bound to a certain context a
> priori, you have
> to use reduce in order to get the expected results:
>
> my-func: func [arg [block!]]  [
>   foreach [name value] arg [
>     print reduce ["Name: " name]
>     print reduce ["Value: " value]
>   ]
> ]
>
> This way it will work.
>
> Enjoy,
> Chris

Reply via email to