⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iconvjp.c

📁 用于嵌入式Linux系统的标准C的库函数
💻 C
📖 第 1 页 / 共 3 页
字号:
    0x30de,0x5b57,0x0029,0x000d,0x000a,    0x000d,0x000a,0x0020,0x0020,0x006a,    0x0030,0x0032,0x0030,0x0031,0x002d,    0x0038,0x0062,0x002e,0x0074,0x0078,    0x0074,0x0020,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0031,0x306e,0x7247,    0x4eee,0x540d,0x0020,0x3092,0x0020,    0x0038,0x5358,0x4f4d,0x7b26,0x53f7,    0x5316,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0053,0x0068,    0x0069,0x0066,0x0074,0x005f,0x004a,    0x0049,0x0053,0x3068,0x540c,0x3058,    0x000d,0x000a,0x0020,0x0020,0x006a,    0x0030,0x0032,0x0030,0x0031,0x002d,    0x0065,0x0073,0x002e,0x0074,0x0078,    0x0074,0x0020,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0031,0x306e,0x7247,    0x4eee,0x540d,0x0020,0x3092,0x0020,    0x0045,0x0053,0x0043,0x0028,0x0049,    0x3067,0x7b26,0x53f7,0x5316,0x000d,    0x000a,0x0020,0x0020,0x006a,0x0030,    0x0032,0x0030,0x0031,0x002d,0x0073,    0x006f,0x002e,0x0074,0x0078,0x0074,    0x0020,0x002d,0x0020,0x004a,0x0049,    0x0053,0x0020,0x0058,0x0030,0x0032,    0x0030,0x0031,0x306e,0x7247,0x4eee,    0x540d,0x0020,0x3092,0x0020,0x0053,    0x004f,0x002f,0x0053,0x0049,0x3067,    0x7b26,0x53f7,0x5316,0x000d,0x000a,    0x000d,0x000a,0x0020,0x0020,0x006a,    0x0030,0x0032,0x0030,0x0038,0x002d,    0x0038,0x0062,0x002e,0x0074,0x0078,    0x0074,0x0020,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0038,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x3092,0x0020,0x0038,    0x5358,0x4f4d,0x7b26,0x53f7,0x5316,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0045,0x0055,0x0043,    0x002d,0x004a,0x0050,0x3068,0x540c,    0x3058,0x000d,0x000a,0x0020,0x0020,    0x006a,0x0030,0x0032,0x0030,0x0038,    0x002d,0x0037,0x0038,0x002e,0x0074,    0x0078,0x0074,0x0020,0x002d,0x0020,    0x004a,0x0049,0x0053,0x0020,0x0058,    0x0030,0x0032,0x0030,0x0038,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x3092,0x0020,    0x0045,0x0053,0x0043,0x0024,0x0040,    0x3067,0x7b26,0x53f7,0x5316,0x0020,    0x0020,0x0020,0x0020,0x0020,0x3044,    0x308f,0x3086,0x308b,0x65e7,0x004a,    0x0049,0x0053,0x000d,0x000a,0x0020,    0x0020,0x006a,0x0030,0x0032,0x0030,    0x0038,0x002d,0x0038,0x0033,0x002e,    0x0074,0x0078,0x0074,0x0020,0x002d,    0x0020,0x004a,0x0049,0x0053,0x0020,    0x0058,0x0030,0x0032,0x0030,0x0038,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x3092,    0x0020,0x0045,0x0053,0x0043,0x0024,    0x0042,0x3067,0x7b26,0x53f7,0x5316,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x3044,0x308f,0x3086,0x308b,0x65b0,    0x004a,0x0049,0x0053,0x000d,0x000a,    0x000d,0x000a,0x0020,0x0020,0x0065,    0x0030,0x0032,0x0030,0x0031,0x002e,    0x0074,0x0078,0x0074,0x0020,0x002d,    0x002d,0x002d,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0031,0x306e,0x7247,    0x4eee,0x540d,0x0020,0x3092,0x0020,    0x0045,0x0055,0x0043,0x002d,0x004a,    0x0050,0x3067,0x7b26,0x53f7,0x5316,    0x000d,0x000a,0x0020,0x0020,0x0065,    0x0030,0x0032,0x0030,0x0038,0x002e,    0x0074,0x0078,0x0074,0x0020,0x002d,    0x002d,0x002d,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0038,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x3092,0x0020,0x0045,    0x0055,0x0043,0x002d,0x004a,0x0050,    0x3067,0x7b26,0x53f7,0x5316,0x0020,    0x0020,0x0020,0x0020,0x0038,0x30d3,    0x30c3,0x30c8,0x004a,0x0049,0x0053,    0x0058,0x0030,0x0032,0x0030,0x0038,    0x3068,0x540c,0x3058,0x000d,0x000a,    0x000d,0x000a,0x0020,0x0020,0x0073,    0x0030,0x0032,0x0030,0x0031,0x002e,    0x0074,0x0078,0x0074,0x0020,0x002d,    0x002d,0x002d,0x002d,0x0020,0x004a,    0x0049,0x0053,0x0020,0x0058,0x0030,    0x0032,0x0030,0x0031,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x3092,0x0020,0x0053,    0x0068,0x0069,0x0066,0x0074,0x005f,    0x004a,0x0049,0x0053,0x3067,0x7b26,    0x53f7,0x5316,0x0020,0x0038,0x30d3,    0x30c3,0x30c8,0x004a,0x0049,0x0053,    0x0058,0x0030,0x0032,0x0030,0x0031,    0x3068,0x540c,0x3058,0x000d,0x000a,    0x0020,0x0020,0x0073,0x0030,0x0032,    0x0030,0x0038,0x002e,0x0074,0x0078,    0x0074,0x0020,0x002d,0x002d,0x002d,    0x002d,0x0020,0x004a,0x0049,0x0053,    0x0020,0x0058,0x0030,0x0032,0x0030,    0x0038,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x3092,0x0020,0x0053,0x0068,0x0069,    0x0066,0x0074,0x005f,0x004a,0x0049,    0x0053,0x3067,0x7b26,0x53f7,0x5316,    0x000d,0x000a,0x000d,0x000a,0x006a,    0x0074,0x0065,0x0078,0x0074,0x002f,    0x006f,0x0074,0x0068,0x0065,0x0072,    0x0073,0x002f,0x000d,0x000a,0x000d,    0x000a,0x0020,0x0020,0x0062,0x0036,    0x0034,0x006a,0x0069,0x0073,0x002e,    0x0074,0x0078,0x0074,0x0020,0x002d,    0x002d,0x002d,0x0020,0x0049,0x0053,    0x004f,0x002d,0x0032,0x0030,0x0032,    0x0032,0x002d,0x004a,0x0050,0x0020,    0x0028,0x004a,0x0049,0x0053,0x0029,    0x0020,0x3092,0x0020,0x0062,0x0061,    0x0073,0x0065,0x0036,0x0034,0x3067,    0x7b26,0x53f7,0x5316,0x000d,0x000a,    0x0020,0x0020,0x0071,0x0074,0x006a,    0x0069,0x0073,0x002e,0x0074,0x0078,    0x0074,0x0020,0x002d,0x002d,0x002d,    0x002d,0x0020,0x0049,0x0053,0x004f,    0x002d,0x0032,0x0030,0x0032,0x0032,    0x002d,0x004a,0x0050,0x0020,0x0028,    0x004a,0x0049,0x0053,0x0029,0x0020,    0x3092,0x0020,0x0071,0x0075,0x006f,    0x0074,0x0065,0x0064,0x002d,0x0070,    0x0072,0x0069,0x006e,0x0074,0x0061,    0x0062,0x006c,0x0065,0x3067,0x7b26,    0x53f7,0x5316,0x000d,0x000a,0x000d,    0x000a,0x0020,0x0020,0x0062,0x006b,    0x0065,0x0075,0x0063,0x002e,0x0074,    0x0078,0x0074,0x0020,0x002d,0x002d,    0x002d,0x002d,0x0020,0x58ca,0x308c,    0x305f,0x0045,0x0055,0x0043,0x002d,    0x004a,0x0050,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x5148,0x982d,    0x30d3,0x30c3,0x30c8,0x304c,0x30bc,    0x30ed,0x000d,0x000a,0x0020,0x0020,    0x0062,0x006b,0x006a,0x0069,0x0073,    0x002e,0x0074,0x0078,0x0074,0x0020,    0x002d,0x002d,0x002d,0x002d,0x0020,    0x58ca,0x308c,0x305f,0x004a,0x0049,    0x0053,0x0020,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x0045,0x0053,0x0043,0x30b3,0x30fc,    0x30c9,0x304c,0x6b20,0x3051,0x305f,    0x000d,0x000a,0x0020,0x0020,0x0062,    0x006b,0x0073,0x006a,0x0069,0x0073,    0x002e,0x0074,0x0078,0x0074,0x002d,    0x002d,0x002d,0x002d,0x0020,0x58ca,    0x308c,0x305f,0x0053,0x0068,0x0069,    0x0066,0x0074,0x005f,0x004a,0x0049,    0x0053,0x0020,0x0020,0x0020,0x5148,    0x982d,0x30d3,0x30c3,0x30c8,0x304c,    0x30bc,0x30ed,0x000d,0x000a,0x000d,    0x000a,0x0020,0x0020,0x0063,0x0074,    0x0072,0x006c,0x005f,0x007a,0x002e,    0x0074,0x0078,0x0074,0x0020,0x0020,    0x0020,0x0020,0x0020,0x0053,0x0068,    0x0069,0x0066,0x0074,0x005f,0x004a,    0x0049,0x0053,0x0020,0x0020,0x0020,    0x0020,0x0020,0x0020,0x005e,0x005a,    0x30ad,0x30e3,0x30e9,0x30af,0x30bf,    0x4ed8,0x304d,0x0020,0x0020,0x0020,    0x0028,0x0044,0x004f,0x0053,0x98a8,    0x0029,0x000d,0x000a,0x0020,0x0020,    0x006d,0x0061,0x0063,0x0074,0x0078,    0x0074,0x002e,0x0062,0x0069,0x006e,    0x0020,0x0020,0x0020,0x0020,0x0020,    0x30de,0x30c3,0x30af,0x30d0,0x30a4,    0x30ca,0x30ea,0x0049,0x0049,0x30d5,    0x30a9,0x30fc,0x30de,0x30c3,0x30c8,    0x000d,0x000a};#endifstruct iconv_data{    int len;    char *name;    char *data;};#define CONVERSIONS 4struct iconv_data data[] = {#ifdef _ICONV_CONVERTER_EUC_JP    {sizeof(euc_jp), "EUC-JP", (char *)euc_jp},#endif#ifdef _ICONV_CONVERTER_SHIFT_JIS    {sizeof(shift_jis), "SHIFT-JIS", (char *)shift_jis},#endif#ifdef _ICONV_CONVERTER_UTF_8    {sizeof(utf8), "UTF-8", (char *)utf8},#endif#ifdef _ICONV_CONVERTER_UCS_2_INTERNAL    {sizeof(ucs2), "UCS-2-INTERNAL", (char *)ucs2},#endif    {0, NULL, NULL}};#define OUTBUF_LEN 2800char ob[OUTBUF_LEN];iconv_t descs[CONVERSIONS*CONVERSIONS];#define ERROR 0int main(int argc, char **argv){    int i, j, k, d = 0;    size_t n;    char *outbuf, *inbuf;    int conversions = sizeof(data)/sizeof(struct iconv_data) - 1;    puts("JP iconv test");        for (i = 0; i < conversions; i++)    {        for (j = 0; j < conversions; j++)	{	    descs[d] = iconv_open(data[j].name, data[i].name);	    if (descs[d++] == (iconv_t)-1)	    {	        printf("iconv_open(%s, %s)\n", data[i].name, data[j].name);	        perror("");                CHECK(ERROR);	    }	}    }        d = 0;    for (i = 0; i < conversions; i++)    {        for (j = 0; j < conversions; j++)	{	    size_t inbytes = data[i].len;	    size_t outbytes = OUTBUF_LEN;	    inbuf = data[i].data;	    outbuf = (char *)ob;	    if (iconv(descs[d], NULL, NULL, (char **)&outbuf, &outbytes)                                                                       == (size_t)-1)            {                perror("Can't reset shift state");                CHECK(ERROR);            }	                n = iconv(descs[d++], (const char **)&(inbuf), &inbytes, 	                          (char **)&outbuf, &outbytes);            if (n == (size_t)-1)            {	        printf("Conversion from %s to %s FAILED - iconv() "                       "returned -1\n", data[i].name, data[j].name);		perror("");                CHECK(ERROR);            }	    	    if (data[j].len != OUTBUF_LEN - outbytes)	    {                printf("Conversion from %s to %s FAILED",                       data[i].name, data[j].name);	        printf(" - bad output buffer length (%d instead of %d)\n",		       OUTBUF_LEN - outbytes, data[j].len);                CHECK(ERROR);	    }	    	    for (k = 0; k < data[j].len; k++)	    {	        if (ob[k] != data[j].data[k])		{                    printf("Conversion from %s to %s FAILED",                           data[i].name, data[j].name);   	            printf("Error: byte %d is wrong\n", k);		    printf("outbuf value: %#x, inbuf value %#x, "		           "right value: %#x\n",          	           (int)ob[k], (int)(data[i].data[k]), 		           (int)(data[j].data[k]));                    CHECK(ERROR);		}	    }	    printf("iconv from %s to %s was successfully done\n",                   data[i].name, data[j].name);             	}    }        d = 0;    for (i = 0; i < conversions; i++)        for (j = 0; j < conversions; j++)            CHECK(iconv_close(descs[d++]) != -1);    exit(0);}#else /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */int main(int argc, char **argv){    puts("None of UTF-8, EUC-JP, SHIFT-JIS and UCS-2_INTERNAL converters "         "linked, SKIP test");    exit(0);}#endif /* #if defined(_ICONV_CONVERTER_UTF_8) || ... */#else /* #ifdef _ICONV_ENABLED */int main(int argc, char **argv){    puts("iconv library is disabled, SKIP test");    exit(0);}#endif /* #ifdef _ICONV_ENABLED */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -