#include
#include "stdio.h" #include "string.h" namespace myconv{ #include "iconv.h" } using namespace std; int main() { string res = "编码转换,从gbk到utf-8"; char *inChar = (char*)res.c_str(); myconv::iconv_t convObj = myconv::iconv_open("GBK","UTF-8"); size_t inLen,outLen; inLen = strlen(inChar); outLen = inLen+1; char outTxt[outLen]; char *outChar = outTxt; myconv::iconv(convObj, &inChar, &inLen, &outChar, &outLen); myconv::iconv_close(convObj); string newRes(outTxt); cout << newRes; return 0; }
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/211508.html原文链接:https://javaforall.net
