private static byte[] unicode(String string)
    {
        BBAOS stream = new BBAOS();
        for(char c : string.toCharArray())
        {
            if((c >= '\u0001') && (c <= '\u007f'))
            {
                stream.write(c & 0x7f);
            }
            else if((c == '\u0000') || ((c >= '\u0080') && (c <= '\u07ff')))
            {
                stream.write(((c & 0x7c0) >> 6) | 0xc0, (c & 0x3f) | 0x80);
            }
            else if((c >= '\u0800') && (c <= '\uffff'))
            {
                stream.write(((c & 0xf000) >> 12) | 0xe0, ((c & 0xfc0) >> 6) | 0x80, (c & 0x3f) | 0x80);
            }
        }
        byte[] str = stream.toByteArray();
        stream.write(1);
        stream.write(writeInt(str.length, 2));
        stream.write(str);
        return stream.toByteArray();
    }