gpt4 book ai didi

iphone - 翻译错误

转载 作者:搜寻专家 更新时间:2023-10-30 20:07:43 27 4
gpt4 key购买 nike

NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@&tl=%@",strTextOfFilter,strCodeOfLanguage];
NSLog(@"URL : %@",soundURL);

这个节目:http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW

复制url到firefox浏览器。中文翻译是对的,但是到safari的浏览器,就错了!为什么翻译中文是错误的。其他语言是正确的!请帮助我!!!

    NSData *soundData = [NSData dataWithContentsOfURL:[NSURL URLWithString:soundURL]];
NSLog(@"returnSoundData:%@",[NSURL URLWithString:soundURL]);
NSError *err = nil;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithData:soundData error: &err];
[player play];

最佳答案

只需将 &ie=UTF-8 显式地放在 URL 的末尾,无论是在 Safari 中还是在您的代码中。

http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW&ie=UTF-8

完成任务。我猜 Google 服务器对使用的编码感到困惑。

关于iphone - 翻译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3663934/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com