"<" Bug - 18/01/10 11:47 PM
I experienced the following problem:
Trying to develop an RSS parser, I wrote a function that replaces HTML entities, Unicode text and some more stuff. It looks this way:
Now, when I call the function with %something = $feedtextconvert(%x) in a socket (where %x contains the <title> line of a feed), mIRC crashes (reproducible). When I comment out the line replacing the < or I replace the particular line by:
..., it stops crashing. (Any additional character after the < works here, strange enough! Also, replacing < by $chr(60) does not work.)
The > line works fine anyway.
I presume mIRC has some difficulties with the less-than symbol here. May be worth a glance.
Trying to develop an RSS parser, I wrote a function that replaces HTML entities, Unicode text and some more stuff. It looks this way:
Code:
alias -l feedtextconvert { var %tempvar,%feedconverted = $1- %feedconverted = $replace(%feedconverted,$chr(9),$chr(32)) %tempvar = $regsub(%feedconverted,/"/g,",%feedconverted) %tempvar = $regsub(%feedconverted,/</g,<,%feedconverted) %tempvar = $regsub(%feedconverted,/>/g,>,%feedconverted) %tempvar = $regsub(%feedconverted,/ /g,$chr(32),%feedconverted) %tempvar = $regsub(%feedconverted,/ä/g,ä,%feedconverted) %tempvar = $regsub(%feedconverted,/ü/g,ü,%feedconverted) %tempvar = $regsub(%feedconverted,/ö/g,ö,%feedconverted) %tempvar = $regsub(%feedconverted,/Ä/g,Ä,%feedconverted) %tempvar = $regsub(%feedconverted,/Ü/g,Ü,%feedconverted) %tempvar = $regsub(%feedconverted,/Ö/g,Ö,%feedconverted) %tempvar = $regsub(%feedconverted,/ß/g,ß,%feedconverted) %tempvar = $regsub(%feedconverted,/&(\S*);/g,,%feedconverted) if ($isutf(%feedconverted)) { %feedconverted = $utfdecode(%feedconverted,0) } %tempvar = $regsub(%feedconverted,/<br( \/)?>/g,\\n,%feedconverted) %feedconverted = $regsubex(%feedconverted,/<a (\s|\S|=|\")*>(\s|\S|=|\")*<\/a>/g,\2) %feedconverted = $regsubex(%feedconverted,/<img(\s|\S|=|\")* alt=\"(\s|\S)\"(\s|\S|=|\")*( \/)?>/g,\2) %tempvar = $regsub(%feedconverted,/<(\/?)(\S*)>/g,,%feedconverted) return %feedconverted }
Now, when I call the function with %something = $feedtextconvert(%x) in a socket (where %x contains the <title> line of a feed), mIRC crashes (reproducible). When I comment out the line replacing the < or I replace the particular line by:
Code:
%feedconverted = $replace(%feedconverted,<,$+(<,$chr(32)))
..., it stops crashing. (Any additional character after the < works here, strange enough! Also, replacing < by $chr(60) does not work.)
The > line works fine anyway.
I presume mIRC has some difficulties with the less-than symbol here. May be worth a glance.