Iphone 翻译错误
本节目:Iphone 翻译错误,iphone,objective-c,Iphone,Objective C,本节目:http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW 将url复制到firefox的浏览器。这是正确的中文翻译,但对于safari浏览器来说,这是错误的!为什么中文翻译是错误的。其他语言是正确的!! 请帮帮我 NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@
http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW
将url复制到firefox的浏览器。这是正确的中文翻译,但对于safari浏览器来说,这是错误的!为什么中文翻译是错误的。其他语言是正确的!!
请帮帮我
NSString *soundURL = [NSString stringWithFormat:@"http://translate.google.com/translate_tts?q=%@&tl=%@",strTextOfFilter,strCodeOfLanguage];
NSLog(@"URL : %@",soundURL);
在Safari和您的代码中,只需将
&ie=UTF-8
明确地放在URL的末尾
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];
他做这项工作。我猜谷歌服务器被使用的编码弄糊涂了
http://translate.google.com/translate_tts?q=%E4%BD%A0%E5%A5%BD&tl=zh-TW&ie=UTF-8