Case-insensitive bugs - 24/11/17 07:07 PM
I have encountered some problems with mIRC by distinguishing between uppercase and lowercase Latin letters in case-insensitive comparisons and token identifiers.
I used as an example only a few letters, but the problem occurs with others as well.
All of these examples return $false, but should return $true
Now they return $true, because $lower converts correctly.
In these examples they also return $true, because the $upper also converts correctly.
Here a code with more letters:
return:
à != À
á != Á
â != Â
ã != Ã
ä != Ä
å != Å
è != È
é != É
ê != Ê
ë != Ë
ì != Ì
í != Í
î != Î
ï != Ï
ò != Ò
ó != Ó
ô != Ô
õ != Õ
ö != Ö
ù != Ù
ú != Ú
û != Û
ü != Ü
ç != Ç
ñ != Ñ
The return should be all v1 == v2. It would only be v1 !== v2 if it were ===
Demonstrating error in $istok
However, it should return everything $true. The return should be all $false if it were $istokcs
Now problem with $addtok that repeats with all other token identifiers
In this example you should not add
Already in this example you must add, as was added
I will not be demonstrating a lot of examples with all token identifiers as there is no need.
I used as an example only a few letters, but the problem occurs with others as well.
Code:
//if (Ã == ã) { echo -a $true } | else { echo -a $false } //if (É == é) { echo -a $true } | else { echo -a $false } //if (Ô == ô) { echo -a $true } | else { echo -a $false } //if (Ñ == ñ) { echo -a $true } | else { echo -a $false } //if (Ç == ç) { echo -a $true } | else { echo -a $false }
All of these examples return $false, but should return $true
Code:
//if ($lower(Ã) === ã) { echo -a $true } | else { echo -a $false } //if ($lower(É) === é) { echo -a $true } | else { echo -a $false } //if ($lower(Ô) === ô) { echo -a $true } | else { echo -a $false } //if ($lower(Ñ) === ñ) { echo -a $true } | else { echo -a $false } //if ($lower(Ç) === ç) { echo -a $true } | else { echo -a $false }
Now they return $true, because $lower converts correctly.
Code:
//if (Ã === $upper(ã)) { echo -a $true } | else { echo -a $false } //if (É === $upper(é)) { echo -a $true } | else { echo -a $false } //if (Ô === $upper(ô)) { echo -a $true } | else { echo -a $false } //if (Ñ === $upper(ñ)) { echo -a $true } | else { echo -a $false } //if (Ç === $upper(ç)) { echo -a $true } | else { echo -a $false }
In these examples they also return $true, because the $upper also converts correctly.
Here a code with more letters:
Code:
//var %l = à á â ã ä å è é ê ë ì í î ï ò ó ô õ ö ù ú û ü ç ñ,%x = 1 | while (%x <= $numtok(%l,32)) { if ($gettok(%l,%x,32) == $upper($gettok(%l,%x,32))) { echo -a $v1 == $v2 } | else { echo -a $v1 != $v2 } | inc %x }
return:
à != À
á != Á
â != Â
ã != Ã
ä != Ä
å != Å
è != È
é != É
ê != Ê
ë != Ë
ì != Ì
í != Í
î != Î
ï != Ï
ò != Ò
ó != Ó
ô != Ô
õ != Õ
ö != Ö
ù != Ù
ú != Ú
û != Û
ü != Ü
ç != Ç
ñ != Ñ
The return should be all v1 == v2. It would only be v1 !== v2 if it were ===
Demonstrating error in $istok
Code:
//var %l = à á â ã ä å è é ê ë ì í î ï ò ó ô õ ö ù ú û ü ç ñ,%x = 1 | while (%x <= $numtok(%l,32)) { if ($istok(%l,$upper($gettok(%l,%x,32)),32)) { echo -a $v1 } | else { echo -a $v1 } | inc %x }
However, it should return everything $true. The return should be all $false if it were $istokcs
Now problem with $addtok that repeats with all other token identifiers
Code:
//var %token = ã | echo -a $addtok(%token,Ã,32)
In this example you should not add
Code:
//var %token = ã | echo -a $addtokcs(%token,Ã,32)
Already in this example you must add, as was added
I will not be demonstrating a lot of examples with all token identifiers as there is no need.