function unicodefromutf8(strutf8) { var bstr = ""; var ntotalchars = strutf8.length; // total chars to be processed. var noffset = 0; // processing point on strutf8 var nremainingbytes = ntotalchars; // how many bytes left to be converted var noutputposition = 0; var icode, icode1, icode2; // the value of the unicode.
while (noffset ntotalchars) { icode = strutf8.charcodeat(noffset); if ((icode 0x80) == 0) // 1 byte. { if ( nremainingbytes 1 ) // not enough data break;