I'm unsure if this is by design or is a bug, but there's at least 1 bug in here. Sometimes $maxlenl means 'characters' and other times 'bytes'.
Not an error: //echo -a $str($chr(10004),8280) $+ x is 24841 bytes
but other string functions are silently ignoring characters beyond the byte length. Both output the same hash:
//echo -a $sha256($str($chr(10004),2764))
//echo -a $sha256($str($chr(10004),2765))
i.e. 2764*3=8292
same happens with: $md5 $sha1/256/384/512 $crc $hmac $hotp $totp
but not with $hash
bset does not return an error, but limits bytes added to a &binvar at 8292:
//bset -t &v 1 $str($chr(10004),6000) | echo -a $bvar(&v,0) $sha256(&v,1)
result: 8292 (hash for 2764 UTF8 characters)
but /write can output a variable containing 8270 10004's.
$len doesn't report a number larger than 8292, and there's no line-too-long error:
//echo -a $len($utfencode($str($chr(10004),3000)))
It also appears that mIRC can receive a byte string from a DLL somewhat longer than double the 8292 bytes without crashing, but it doesn't appear that mIRC can send more than 8292 bytes worth of unicode characters to a dll. This is related to my question
here