Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to decode A_char array into Chinese string using plugin SDK?

Explorer ,
Mar 13, 2022 Mar 13, 2022

shell22398911sc0d_1-1647171249301.pngexpand image

The name of the project is 测试.aep in Chinese, How can I convert proj_nameAC to Chinese string?

TOPICS
SDK
754
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2022 Mar 13, 2022

perhpas AEGP_GetProjectPath which returns a utf16 string?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2022 Mar 13, 2022

In this way, it can be converted into Chinese, but this way uses python

https://stackoverflow.com/questions/2190904/how-to-correct-the-misencoded-string 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 13, 2022 Mar 13, 2022
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2022 Mar 13, 2022

thanks for your help, how to convert multybyte to wide char on mac?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2022 Mar 13, 2022
LATEST
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);

 

this code works for me,thank you again for your help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines