mIRC Home    About    Download    Register    News    Help

Print Thread
#138969 09/01/06 01:55 AM
Joined: Oct 2005
Posts: 98
S
Babel fish
OP Offline
Babel fish
S
Joined: Oct 2005
Posts: 98
Hi, I got this alias:
Code:
/g /say http://www.google.com/search?q= $+ $replace($1-,$chr(32),+) 

Wich works as it should, but if I type this:
/g 1+1
The result gives me 1 1 in the google searchbar, my question is, what can be changed?

#138970 09/01/06 05:00 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
the answer was as close as your web browser
you might do a google search for special characters in html

or click this link

#138971 09/01/06 05:20 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
All characters that aren't alphanumeric must be changed to their hexadecimal equivalent. Try this code:

/g {
var %a = $1-
while ($regex(a,%a,/([^% \w])/Sg)) {
%a = $replace(%a,$regml(a,1),% $+ $base($asc($regml(a,1)),10,16))
if ($calc($len(%a) $+ 2) > 800) break
}
say http://www.google.com/search?q= $+ $replace(%a,$chr(32),+)
}
(untested)

-genius_at_work

#138972 09/01/06 06:31 PM
Joined: Nov 2005
Posts: 42
A
Ameglian cow
Offline
Ameglian cow
A
Joined: Nov 2005
Posts: 42
the following will return text with non alphanumerics replace with their hex equivalents.

usage: $urlencode(string)
Code:
alias urlencode {
  var %cRet = $1-
  while ($regex(%cRet, /([^\w-.\x03])/)) {
    !haltdef $regsub(%cRet, /([^\w-.\x03])/,  $+ $base($asc($regml(1)), 10, 16, 2), %cRet)
  }
  return $replace(%cRet, , %)
}


Link Copied to Clipboard