mIRC Home    About    Download    Register    News    Help

Print Thread
[7.xx] Bug in $regml().pos #220537 17/04/10 07:45 PM
Joined: Dec 2002
Posts: 4
Z
zati Offline OP
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: Dec 2002
Posts: 4
$regml().pos counts 2 characters for each UTF-8 character.

To reproduce this bug, add this alias

Code:
alias test {
  var %num = $regex(mts,$1-,/(<[-_.a-zA-Z0-9]+>)/g)
  while (%num >= 1) {
    echo ** $regml(mts,%num) * $regml(mts,%num).pos
    dec %num
  }
}

Then type

Code:
/test test้ <t> <a>


Results in mIRC 7.xx :
Code:
** <a> * 12
** <t> * 8


Results in mIRC 6.xx
Code:
** <a> * 11
** <t> * 7

Re: [7.xx] Bug in $regml().pos [Re: zati] #220539 17/04/10 07:57 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
The difference there is that mIRC 6.35 is not UTF-8-encoding the text before passing it to the regular expression engine. If you were to use $utfencode() in 6.35 you'd get the same result as on 7.01.

Re: [7.xx] Bug in $regml().pos [Re: Collective] #220595 19/04/10 11:46 AM
Joined: Dec 2002
Posts: 4
Z
zati Offline OP
Self-satisified door
OP Offline
Self-satisified door
Z
Joined: Dec 2002
Posts: 4
Since $len() and $pos() reports correct length/position, I think $regml().pos should be corrected to be consistent with other identifiers.

Re: [7.xx] Bug in $regml().pos [Re: zati] #220766 23/04/10 04:00 PM
Joined: Dec 2002
Posts: 4,838
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 4,838
Thanks this has been fixed for the next version.