/* utf8conv.c: Test driver for UTF8 conversions in unistring.c */ /* public declarations */ #include "unistring.h" #include int main(int argc, char *argv[]) { int argNo, ucs16_opt, utf8_opt, j; int result, remaining, encoded, decoded; if (argc < 2) { printf("Usage: %s (-ucs16 |-utf8 |)\n", argv[0]); exit(1); } ucs16_opt = 0; utf8_opt = 0; argNo = 1; if (argc > 1) { argNo = 2; if (strcmp(argv[1],"-ucs16") == 0) { ucs16_opt = 1; } else if (strcmp(argv[1],"-utf8") == 0) { utf8_opt = 1; } } if (ucs16_opt) { char* tems = argv[argNo]; int nus = strlen(argv[argNo])/4; int ns = 3*nus; UNICHAR* us = (UNICHAR*) malloc((nus+1)*sizeof(UNICHAR)); unsigned char* s = (unsigned char*) malloc(ns+1); char temus[5] = {0,0,0,0,0}; for (j=0; j