if (0x80 <= code && code <= 0x7FF) {
sb.appendByte(0xC0 | (code >> 6));
sb.appendByte(0x80 | (code & 0x3F));
}
else if (0x800 <= code && code <= 0xFFFF) {
sb.appendByte(0xE0 | (code >> 12));
sb.appendByte(0x80 | ((code >> 6) & 0x3F));
sb.appendByte(0x80 | (code & 0x3F));
}
else {
sb.appendByte(0xF0 | (code >> 18));