[AE开发]如何使用插件 SDK 将 A_char 数组解码为中文字符串?

原贴:https://community.adobe.com/t5/after-effects-discussions/how-to-decode-a-char-array-into-chinese-string-using-plugin-sdk/td-p/12809920

int code_convert(char *from_charset,char *to_charset,char *inbuf,int inlen,char *outbuf,int outlen)
{
        iconv_t cd;
        int rc;
        char **pin = &inbuf;
        char **pout = &outbuf;
        cd = iconv_open(to_charset,from_charset);
        if (cd==0) return -1;
        memset(outbuf,'\0',outlen);
        if (iconv(cd,pin,(size_t *)&inlen,pout,(size_t*)&outlen)==-1) return -1;
        iconv_close(cd);
        return 0;
}
char  gb2312Char[255] = "";
code_convert("gb2312","utf-8",proj_nameAC,strlen(proj_nameAC),gb2312Char,255);