mIRC Home    About    Download    Register    News    Help

Print Thread
#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

Joined: Dec 2002
Posts: 3,138
C
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.

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.

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks this has been fixed for the next version.


Link Copied to Clipboard