some one dedicated can port this javascript code to mirc script (it CAN be done!)
http://www.webtoolkit.info/javascript-utf8.htmlmostly you only need this, turn it into an alias.
// public method for url decoding
decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
this doesnt work, but its a start for someone who wants to fix it:
//echo -a $utf8decode(aáéíóúe)
returns:
7 9 2 2 2 2 2
alias utf8decode {
bset -t &utftext 1 $1-
var %string
var %i = 0
var %c = c1
var %c2 = 0
while (%i < $bvar(&utftext,0)) {
var %c = $asc($bvar(&utftext, %i))
if (%c < 128) {
%string = %string $chr(%c)
inc %i
}
elseif ((%c > 191) && (%c < 224)) {
%c2 = $asc($bvar(&utftext, %i+1))
%string = %string $chr(((%c & 31) << 6) | (%c2 & 63))
%i = $calc(%i + 2)
}
else {
%c2 = $asc($bvar(&utftext, %i+1))
%c3 = $asc($bvar(&utftext, %i+2))
%string = %string $chr(((%c & 15) << 12) | ((%c2 & 63) << 6) | (%c3 & 63))
%i = $calc(%i + 3)
}
}
return %string
}
these will come in handy:
http://www.w3schools.com/jsref/jsref_fromCharCode.asphttp://www.w3schools.com/jsref/jsref_charCodeAt.asphttp://jennifermadden.com/javascript/operators.htmla += b is the same as a = a + b
that is a good start i think.