src/basis/utils/utf16.js
function fromUTF8(input){
    var output = '';
    var len = input.length;
    var i = 0;
    var c1;
    var c2;
    var c3;

    while (i < len)
    {
      c1 = input.charCodeAt(i++);
      if (c1 < 128)
        output += chars[c1];
      else
      {
        c2 = input.charCodeAt(i++);
        if (c1 & 32)
        {
          c3 = input.charCodeAt(i++);
          output += String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
        }
        else
          output += String.fromCharCode(((c1 & 31) << 6)  | (c2 & 63));
      }
    }
    return output;
  }
function fromUTF8(input){
    var output = '';
    var len = input.length;
    var i = 0;
    var c1;
    var c2;
    var c3;

    while (i < len)
    {
      c1 = input.charCodeAt(i++);
      if (c1 < 128)
        output += chars[c1];
      else
      {
        c2 = input.charCodeAt(i++);
        if (c1 & 32)
        {
          c3 = input.charCodeAt(i++);
          output += String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
        }
        else
          output += String.fromCharCode(((c1 & 31) << 6)  | (c2 & 63));
      }
    }
    return output;
  }
function fromUTF8 ( input ) { var output = '' ; var len = input . length ; var i = 0 ; var c1 ; var c2 ; var c3 ; while ( i < len ) { c1 = input . charCodeAt ( i ++ ) ; if ( c1 < 128 ) output += chars [ c1 ] ; else { c2 = input . charCodeAt ( i ++ ) ; if ( c1 & 32 ) { c3 = input . charCodeAt ( i ++ ) ; output += String . fromCharCode ( ( ( c1 & 15 ) << 12 ) | ( ( c2 & 63 ) << 6 ) | ( c3 & 63 ) ) ; } else output += String . fromCharCode ( ( ( c1 & 31 ) << 6 ) | ( c2 & 63 ) ) ; } } return output ; }
utf8 string -> utf16 string
utf8 string - > utf16 string