- 论坛徽章:
- 0
|
int Convert(char* encFrom, char* encTo, const char* in, int in_len, char* out, int out_len)
{
char* sin, *sout;
int ret;
iconv_t c_pt;
printf("1\n");
if((c_pt = iconv_open(encTo, encFrom)) == (iconv_t)-1)
{
printf("c_pt == -1\n");
return GBK_TO_UTF8_ERROR;
}
/*iconv(c_pt, NULL, NULL, NULL, NULL);*/
printf("2\n");
sin = (char*)in;
sout = (char*)out;
ret = iconv(c_pt, &sin, (size_t*)&in_len, &sout, (size_t*)&out_len);
printf("3\n");
if(ret == -1)
{
printf("iconv error\n");
iconv_close(c_pt);
return GBK_TO_UTF8_ERROR;
}
printf("4\n");
iconv_close(c_pt);
return SUCCEED;
}
|
在用hp15CN代理gbk后,
#0 0xc0000000000325f8 in _instantiate_iconv+0x58 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl
(gdb) where
#0 0xc0000000000325f8 in _instantiate_iconv+0x58 () from /usr/lib/nls/iconv/pa20_64/methods.2/lhp15utf8.sl
#1 0xc000000000215200 in iconv+0x30 () from /usr/lib/pa20_64/libc.2
#2 0x4000000000018778 in Convert+0x100 ()
#3 0x400000000001cccc in ProcessFlightSupply+0x34c ()
#4 0x400000000000e07c in GetFlightSupplies+0x127c ()
#5 0x4000000000017e04 in main+0x11b4 ()
调用函数
Convert("hp15CN", "utf8", fli_sup->supplies_desc, sizeof(fli_sup->supplies_desc)+1, temp, sizeof(temp));
在linux是用gbk代替hp15CN的
高手指点下从数据库select出来的中文怎么在hp unix转换成utf8,谢谢了
[ 本帖最后由 tempname_cn 于 2008-10-6 16:35 编辑 ] |
|