libiconv convert utf8 to gbk fialed when text contains ellipsis(……) only in iOS17, and in Xcode 15 I update the libiconv because it's old.
I have test libiconv.tbd and libicon.2.tbd the same result.
Condition:
only iOS 17, iOS 16- is OK;
Text contains ellipsis(……) such as ……测试字符串;
Convert to gbk or gb18030 is failed and return -1, but gb2312 return is OK。
int code_convert(const char *from_charset, const char *to_charset, char *inbuf, size_t inlen,
char *outbuf, size_t outlen) {
iconv_t cd;
char **pin = &inbuf;
char **pout = &outbuf;
cd = iconv_open(to_charset, from_charset);
if (cd == 0)
return -1;
memset(outbuf, 0, outlen);
if ((int)iconv(cd, pin, &inlen, pout, &outlen) == -1)
{
iconv_close(cd);
std::cout<< "转换失败" << std::endl;
return -1;
}
iconv_close(cd);
return 0;
}
int u2g(char *inbuf, size_t inlen, char *outbuf, size_t outlen) {
//gb18030 , gb2312
return code_convert("utf-8", "gb2312", inbuf, inlen, outbuf, outlen);
}
std::string UTFtoGBK(const char* utf8)
{
int length = strlen(utf8);
char *temp = (char*)malloc(sizeof(char)*length);
if(u2g((char*)utf8,length,temp,length) >= 0)
{
std::string str_result;
str_result.append(temp);
free(temp);
return str_result;
}else
{
free(temp);
return "";
}
}
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I was play a pcm(24kHz 16bit) file with AudioQueue, and it mix with other sound( 192kHz 24bit) named sound2.
Setting for AVAudioSession as:
category (AVAudioSessionCategoryPlayback),
options (AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDuckOthers)
when playing pcm the sound2 should pushed volume lower as setting. BUT, there has a absolutly mute keep 0.5 second when the sound2 become low, and after a 0.5s mute the pushed lower sound came out.
It only become in sound2 situation(192kHz, 24bit). if the sound2's quality lower everything is OK.