Hi folks

I need some help to fix this script - wich I borrowed from PHP and works
good with Portuguese strings -

Whenever I try the link with some foreign chars it gives me errors:

http://www.revistaeletronica.com.br/cgi-bin/encrypt.cgi?texto=dog ---> OK

http://www.revistaeletronica.com.br/cgi-bin/encrypt.cgi?texto=cão ---> ERROR


Follows the CGI script:

#!rebol -cs
REBOL[]

encrypt: func[frase [string!] key [string!]
/local result char keychar][
result: copy ""
for i 1 length? frase 1[
char: copy/part at frase i 1
keychar: copy/part at key (i // length? key) 1
char: to-char (to-integer to-char char) + (to-integer to-char keychar)
result: join result char
]
]

decrypt: func[frase [string!] key [string!]
/local result char keychar][
result: copy ""
for i 1 length? frase 1[
char: copy/part at frase i 1
keychar: copy/part at key (i // length? key) 1
char: to-char (to-integer to-char char) - (to-integer to-char keychar)
result: join result char
]
]

cgi-input: make object! decode-cgi system/options/cgi/query-string

key: "madeline"

pass: encrypt cgi-input/texto key

print "content-type: text/html ^/^/"
print pass
print decrypt pass key


TIA

--
*:-.,_,.-:*'``'*:-.,_,.-:
Carlos Lorenz
*:-.,_,.-:*'``'*:-.,_,.-:

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to