标签归档:gbk

RSS feed of gbk

最后更新于 .

经常会用到gbk和utf8互转的情况,下面的代码就是实现了这样的功能,希望对大家有用~  

//GBK 2 UTF8
int API_Gbk2Utf8(const char *szSource, string &strDest)
{
    char szUniString[strlen(szSource)*2];
    int iLen = string_gbk2unicode(szSource, szUniString, strlen(szSource));
    unsigned char pTemp[4] = {0};
    unsigned short iTemp;
    char *pUTFString = (char *)malloc(sizeof(szUniString) *2+1);
    int pos=0;
    for (int i=0; i<iLen; i++)
    {
        iTemp =(((unsigned char)szUniString ...