ciabatta/test/test_uchar.c

20 lines
409 B
C
Raw Permalink Normal View History

2022-06-22 12:36:26 +00:00
2022-07-02 07:51:30 +00:00
#include <unicode.h>
#include <stdio.h>
2022-06-22 12:36:26 +00:00
int main() {
2022-07-02 07:51:30 +00:00
char *mbstr = u8"улыбок тебе дед макар";
2022-06-22 12:36:26 +00:00
{
2022-07-02 07:51:30 +00:00
char *str = mbstr;
uchar_t ch;
int len;
while((len = utf8_dec(str, &ch)) > 0 && ch != 0) {
printf("char: %d\n", ch);
str += len;
}
if(len <= 0) {
printf("This string is not utf8\n");
}
2022-06-22 12:36:26 +00:00
}
}