在linux下用gsoap得到数据时,中文是乱码
用iconv可以处理
具体处理见代码:
#include <iconv.h>
int conv_charset(const char *dest, const char *src, char *input, size_t ilen, char *output, size_t olen) {
iconv_t conv = iconv_open(dest, src);
if ( conv == (iconv_t) -1 )
return -1;
memset(output, 0, olen);
if ( iconv(conv, &input, &ilen, &output, &olen) )
return -1;
iconv_close(conv);
return 0;
}
conv_charset('GBK', 'UTF-8', response.getStockInfoByCodeResult
->string[i], ilen, output, OUTPUT_LEN) )