2017-09-10 16:50:19 +08:00
|
|
|
// this file contains BMP chars encoded in UTF-8
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <wchar.h>
|
2021-01-18 05:21:07 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2017-09-10 16:50:19 +08:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2021-01-18 15:28:31 +08:00
|
|
|
char hello_world_in_czech[] = "čau, světe";
|
|
|
|
char hello_world_in_czech_ucn[] = "\u010dau, sv\u011bte";
|
|
|
|
if (sizeof(hello_world_in_czech) != sizeof(hello_world_in_czech_ucn)
|
|
|
|
|| strcmp(hello_world_in_czech, hello_world_in_czech_ucn))
|
|
|
|
abort();
|
2021-01-18 05:21:07 +08:00
|
|
|
|
2017-09-10 16:50:19 +08:00
|
|
|
wchar_t s[] = L"hello$$你好¢¢世界€€world";
|
|
|
|
wchar_t *p;
|
|
|
|
for (p = s; *p; p++) printf("%04X ", (unsigned) *p);
|
2021-01-18 15:28:31 +08:00
|
|
|
printf("\n");
|
2017-09-10 16:50:19 +08:00
|
|
|
return 0;
|
|
|
|
}
|