#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "unicode.h"
|
|
|
|
size_t utf8_chsize(uint32_t ch) {
|
|
if (ch < 0x80) {
|
|
return 1;
|
|
} else if (ch < 0x800) {
|
|
return 2;
|
|
} else if (ch < 0x10000) {
|
|
return 3;
|
|
}
|
|
return 4;
|
|
}
|