encodeUTF8 static method
Implementation
static int encodeUTF8(Uint8List buf, int offset, String value) {
final int n = value.length;
int out = offset;
for (int i = 0; i < n; ++i) {
final c = value[i].codeUnitAt(0);
if (c < 0x80) {
buf[out++] = c;
} else if (c < 0x800) {
buf[out++] = ((c >> 6) | 192);
buf[out++] = ((c & 63) | 128);
} else {
buf[out++] = ((c >> 12) | 224);
buf[out++] = (((c >> 6) & 63) | 128);
buf[out++] = ((c & 63) | 128);
}
}
return out - offset;
}